Merge branch 'master' of 10.10.14.250:huanghai/dsMin

master
wubin 5 years ago
commit 060a1009fa

@ -8,6 +8,7 @@
"horizontal": "center",
"vertical": "center"
},
"number_format": 49,
"border": [
{
"type": "left",

@ -4,6 +4,7 @@
"size": 14,
"color": "#000000"
},
"number_format": 49,
"alignment": {
"horizontal": "center",
"vertical": "center"

@ -16,5 +16,5 @@ func main(){
}
studentTemplate = studentTemplate +"student.xlsx"
ExcelUtil.GenerateTemplate(jsonTemplate, studentTemplate)
fmt.Println("恭喜,学生导入的基本结构生成成功,请手动设置身份证列为文本格式,现在的库不支持这样设置,只能手动来了~")
fmt.Println("恭喜,学生导入的基本结构生成成功!")
}

@ -16,5 +16,5 @@ func main(){
}
teacherTemplate=teacherTemplate+"teacher.xlsx"
ExcelUtil.GenerateTemplate(jsonTemplate,teacherTemplate)
fmt.Println("恭喜,教师导入的基本结构生成成功,请手动设置身份证列为文本格式,现在的库不支持这样设置,只能手动来了~")
fmt.Println("恭喜,教师导入的基本结构生成成功!")
}

@ -57,7 +57,6 @@
{
"col_name": "身份证件类型",
"width": 20,
"require": true,
"level_1_sql": true,
"sql_num": 1,
"sql_parameter": [

@ -6,6 +6,7 @@ import (
"dsBaseRpc/Utils/DbUtil"
"dsBaseRpc/Utils/SqlKit"
"dsBaseRpc/models"
"errors"
"github.com/xormplus/builder"
)
@ -52,10 +53,48 @@ func TreeBasePosition() ([]map[string]interface{}, int, error) {
}
//根据单位ID获取职务信息
func ListBasePositionByBureauId(in *BasePositionProto.QueryArg) ([]map[string]interface{}, int32, error) {
//1、哪个级别
in.
func ListBasePositionByBureauId(in *BasePositionProto.ListBasePositionByBureauIdArg) ([]map[string]interface{}, int, error) {
//1、获取单位信息
bureauId := in.BureauId
list := SqlKit.QueryByIds([]string{bureauId}, "t_base_organization")
if list == nil || len(list) == 0 {
return nil, -1, errors.New("无法找到指定的单位ID")
}
//2、这个单位ID是哪个类型的org_type
//3、如果是学校那么还需要知道 xxbxlxm
orgType := list[0]["org_type"].(int64)
//区域代码
areaCode := list[0]["area_code"].(string)
//办学类型
xxbxlxm := list[0]["xxbxlxm"].(string)
//级别
var areaLevel int32
//获取org_type 1:教育局2学校
if orgType == 1 {
//通过areaCode 获取区域级别是1还是2
if areaCode[4:] == "00" {
areaLevel = 1 //市级
} else {
areaLevel = 2 //县区级
}
} else { //2是学校
//如果是学校因为学校全都是在县区中存在所以areaLevel=2
areaLevel = 2
}
var myBuilder = builder.Dialect(builder.MYSQL).Select("*").From("t_base_position")
myBuilder.Where(builder.Eq{"b_use": 1})
myBuilder.And(builder.Eq{"area_level": areaLevel})
myBuilder.And(builder.Eq{"org_type": orgType})
//如果是学校,那么还需要判断学校办学类型
if orgType == 2 {
myBuilder.And(builder.Eq{"xxbxlxm": xxbxlxm})
}
myBuilder.OrderBy("sort_id")
//获取拼接完成的SQL语句
sql, err := myBuilder.ToBoundSQL()
if err != nil {
return nil, 0, err
}
//调用多查询字段通用方法
list, err = db.SQL(sql).Query().List()
return list, len(list), err
}

@ -460,7 +460,7 @@ var file_BasePosition_proto_rawDesc = []byte{
0x12, 0x12, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x4c, 0x69, 0x73, 0x74, 0x22, 0x20, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x64,
0x73, 0x41, 0x72, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x09, 0x52, 0x03, 0x49, 0x64, 0x73, 0x32, 0xf2, 0x03, 0x0a, 0x12, 0x42, 0x61, 0x73, 0x65, 0x50,
0x09, 0x52, 0x03, 0x49, 0x64, 0x73, 0x32, 0x87, 0x04, 0x0a, 0x12, 0x42, 0x61, 0x73, 0x65, 0x50,
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x12, 0x4a, 0x0a,
0x0f, 0x47, 0x65, 0x74, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x1b, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50,
@ -486,17 +486,18 @@ var file_BasePosition_proto_rawDesc = []byte{
0x73, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x72, 0x67, 0x1a, 0x18, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50,
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70,
0x6c, 0x79, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x61, 0x73, 0x65,
0x6c, 0x79, 0x22, 0x00, 0x12, 0x6a, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x61, 0x73, 0x65,
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x42, 0x75, 0x72, 0x65, 0x61, 0x75,
0x49, 0x64, 0x12, 0x1b, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x72, 0x67, 0x1a,
0x18, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x40, 0x0a, 0x16, 0x63,
0x6f, 0x6d, 0x2e, 0x64, 0x73, 0x69, 0x64, 0x65, 0x61, 0x6c, 0x2e, 0x64, 0x73, 0x6d, 0x69, 0x6e,
0x2e, 0x62, 0x61, 0x73, 0x65, 0x42, 0x0c, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74,
0x69, 0x6f, 0x6e, 0x50, 0x01, 0x5a, 0x13, 0x2e, 0x3b, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x73,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0xa2, 0x02, 0x00, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x49, 0x64, 0x12, 0x30, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x61, 0x73, 0x65, 0x50,
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x42, 0x75, 0x72, 0x65, 0x61, 0x75, 0x49,
0x64, 0x41, 0x72, 0x67, 0x1a, 0x18, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74,
0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00,
0x42, 0x40, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x73, 0x69, 0x64, 0x65, 0x61, 0x6c, 0x2e,
0x64, 0x73, 0x6d, 0x69, 0x6e, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x42, 0x0c, 0x42, 0x61, 0x73, 0x65,
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x01, 0x5a, 0x13, 0x2e, 0x3b, 0x42, 0x61,
0x73, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0xa2,
0x02, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -525,7 +526,7 @@ var file_BasePosition_proto_depIdxs = []int32{
4, // 2: BasePositionProto.BasePositionManage.DeleteBasePosition:input_type -> BasePositionProto.DeleteIdsArg
1, // 3: BasePositionProto.BasePositionManage.UpdateBasePosition:input_type -> BasePositionProto.ModelArg
2, // 4: BasePositionProto.BasePositionManage.TreeBasePosition:input_type -> BasePositionProto.QueryArg
2, // 5: BasePositionProto.BasePositionManage.ListBasePositionByBureauId:input_type -> BasePositionProto.QueryArg
0, // 5: BasePositionProto.BasePositionManage.ListBasePositionByBureauId:input_type -> BasePositionProto.ListBasePositionByBureauIdArg
3, // 6: BasePositionProto.BasePositionManage.GetBasePosition:output_type -> BasePositionProto.Reply
3, // 7: BasePositionProto.BasePositionManage.AddBasePosition:output_type -> BasePositionProto.Reply
3, // 8: BasePositionProto.BasePositionManage.DeleteBasePosition:output_type -> BasePositionProto.Reply
@ -649,7 +650,7 @@ type BasePositionManageClient interface {
//获取职务所有的树形结构信息
TreeBasePosition(ctx context.Context, in *QueryArg, opts ...grpc.CallOption) (*Reply, error)
//根据单位ID获取职务信息
ListBasePositionByBureauId(ctx context.Context, in *QueryArg, opts ...grpc.CallOption) (*Reply, error)
ListBasePositionByBureauId(ctx context.Context, in *ListBasePositionByBureauIdArg, opts ...grpc.CallOption) (*Reply, error)
}
type basePositionManageClient struct {
@ -705,7 +706,7 @@ func (c *basePositionManageClient) TreeBasePosition(ctx context.Context, in *Que
return out, nil
}
func (c *basePositionManageClient) ListBasePositionByBureauId(ctx context.Context, in *QueryArg, opts ...grpc.CallOption) (*Reply, error) {
func (c *basePositionManageClient) ListBasePositionByBureauId(ctx context.Context, in *ListBasePositionByBureauIdArg, opts ...grpc.CallOption) (*Reply, error) {
out := new(Reply)
err := c.cc.Invoke(ctx, "/BasePositionProto.BasePositionManage/ListBasePositionByBureauId", in, out, opts...)
if err != nil {
@ -727,7 +728,7 @@ type BasePositionManageServer interface {
//获取职务所有的树形结构信息
TreeBasePosition(context.Context, *QueryArg) (*Reply, error)
//根据单位ID获取职务信息
ListBasePositionByBureauId(context.Context, *QueryArg) (*Reply, error)
ListBasePositionByBureauId(context.Context, *ListBasePositionByBureauIdArg) (*Reply, error)
}
// UnimplementedBasePositionManageServer can be embedded to have forward compatible implementations.
@ -749,7 +750,7 @@ func (*UnimplementedBasePositionManageServer) UpdateBasePosition(context.Context
func (*UnimplementedBasePositionManageServer) TreeBasePosition(context.Context, *QueryArg) (*Reply, error) {
return nil, status.Errorf(codes.Unimplemented, "method TreeBasePosition not implemented")
}
func (*UnimplementedBasePositionManageServer) ListBasePositionByBureauId(context.Context, *QueryArg) (*Reply, error) {
func (*UnimplementedBasePositionManageServer) ListBasePositionByBureauId(context.Context, *ListBasePositionByBureauIdArg) (*Reply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListBasePositionByBureauId not implemented")
}
@ -848,7 +849,7 @@ func _BasePositionManage_TreeBasePosition_Handler(srv interface{}, ctx context.C
}
func _BasePositionManage_ListBasePositionByBureauId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryArg)
in := new(ListBasePositionByBureauIdArg)
if err := dec(in); err != nil {
return nil, err
}
@ -860,7 +861,7 @@ func _BasePositionManage_ListBasePositionByBureauId_Handler(srv interface{}, ctx
FullMethod: "/BasePositionProto.BasePositionManage/ListBasePositionByBureauId",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BasePositionManageServer).ListBasePositionByBureauId(ctx, req.(*QueryArg))
return srv.(BasePositionManageServer).ListBasePositionByBureauId(ctx, req.(*ListBasePositionByBureauIdArg))
}
return interceptor(ctx, in, info, handler)
}

@ -25,7 +25,7 @@ service BasePositionManage {
//
rpc TreeBasePosition (QueryArg) returns (Reply) {}
//ID
rpc ListBasePositionByBureauId (QueryArg) returns (Reply) {}
rpc ListBasePositionByBureauId (ListBasePositionByBureauIdArg) returns (Reply) {}
}
message ListBasePositionByBureauIdArg {

@ -119,7 +119,7 @@ func (s *Rpc) UpdateBasePosition(ctx context.Context, in *BasePositionProto.Mode
return &reply, nil
}
//同步获取所有表中数据然后以children方式输出
//同步获取所有表中数据
func (s *Rpc) TreeBasePosition(ctx context.Context, in *BasePositionProto.QueryArg) (*BasePositionProto.Reply, error) {
//异常处理
defer func() {
@ -145,7 +145,7 @@ func (s *Rpc) TreeBasePosition(ctx context.Context, in *BasePositionProto.QueryA
}
//根据单位ID获取职务信息
func (s *Rpc) ListBasePositionByBureauId(ctx context.Context, in *BasePositionProto.QueryArg) (*BasePositionProto.Reply, error) {
func (s *Rpc) ListBasePositionByBureauId(ctx context.Context, in *BasePositionProto.ListBasePositionByBureauIdArg) (*BasePositionProto.Reply, error) {
//异常处理
defer func() {
if err := recover(); err != nil {
@ -162,7 +162,7 @@ func (s *Rpc) ListBasePositionByBureauId(ctx context.Context, in *BasePositionPr
LogUtil.Error(ErrorConst.SqlQueryError, "执行ListBasePositionByBureauId时发生严重错误"+err.Error())
return &reply, err
}
reply.Count = count
reply.Count = int32(count)
reply.Success = true
reply.Message = Const.SuccessDataBaseAction
reply.List = CommonUtil.SerializeToString(list)

@ -2,7 +2,6 @@ package main
import (
"fmt"
"log"
"net/http"
)
/**
@ -28,9 +27,11 @@ func HelloServer(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "hello world")
}
func main() {
http.HandleFunc("/hello", HelloServer)
err := http.ListenAndServe(":12345", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
//http.HandleFunc("/hello", HelloServer)
//err := http.ListenAndServe(":12345", nil)
//if err != nil {
// log.Fatal("ListenAndServe: ", err)
//}
areaCode:="11223344"
fmt.Println(areaCode[4:])
}

@ -228,6 +228,7 @@ func GenerateTemplate(jsonTemplate string, excelPath string) () {
tableStylePath = "." + tableStylePath
}
tableStyle, _ := f.NewStyle(FileUtil.ReadFileContent(tableStylePath))
//5、表头
for i := 0; i < cols; i++ {
//设置列宽
@ -277,19 +278,19 @@ func GenerateTemplate(jsonTemplate string, excelPath string) () {
//白色
WhiteJson := GetBackgroundColorStyle(Const.WhiteStyle)
WhiteStyle, _ := f.NewStyle(WhiteJson)
f.SetCellStyle(SheetName,Const.WhiteCell,Const.WhiteCell,WhiteStyle)
f.SetCellStyle(SheetName, Const.WhiteCell, Const.WhiteCell, WhiteStyle)
//红色
RedJson := GetBackgroundColorStyle(Const.RedStyle)
RedStyle, _ := f.NewStyle(RedJson)
f.SetCellStyle(SheetName,Const.RedCell,Const.RedCell,RedStyle)
f.SetCellStyle(SheetName, Const.RedCell, Const.RedCell, RedStyle)
//蓝色
BlueJson := GetBackgroundColorStyle(Const.BlueStyle)
BlueStyle, _ := f.NewStyle(BlueJson)
f.SetCellStyle(SheetName,Const.BlueCell,Const.BlueCell,BlueStyle)
f.SetCellStyle(SheetName, Const.BlueCell, Const.BlueCell, BlueStyle)
//黄色
YellowJson := GetBackgroundColorStyle(Const.YellowStyle)
YellowStyle, _ := f.NewStyle(YellowJson)
f.SetCellStyle(SheetName,Const.YellowCell,Const.YellowCell,YellowStyle)
f.SetCellStyle(SheetName, Const.YellowCell, Const.YellowCell, YellowStyle)
//保存
// 根据指定路径保存文件(不管是不是通过,都保存一次)
if err := f.SaveAs(excelPath); err != nil {

Loading…
Cancel
Save