diff --git a/dsBaseRpc/Config/ExportExcelTemplate/student_account.json b/dsBaseRpc/Config/ExportExcelTemplate/student_account.json index b184cbc8..e8404e10 100644 --- a/dsBaseRpc/Config/ExportExcelTemplate/student_account.json +++ b/dsBaseRpc/Config/ExportExcelTemplate/student_account.json @@ -22,7 +22,7 @@ "width": 30 }, { - "col_name": "登录名", + "col_name": "登录账号", "col_field": "login_name", "width": 30 }, diff --git a/dsBaseRpc/Config/ExportExcelTemplate/sysLoginperson_account.json b/dsBaseRpc/Config/ExportExcelTemplate/sysLoginperson_account_city.json similarity index 85% rename from dsBaseRpc/Config/ExportExcelTemplate/sysLoginperson_account.json rename to dsBaseRpc/Config/ExportExcelTemplate/sysLoginperson_account_city.json index 7ead0619..c47a7c1c 100644 --- a/dsBaseRpc/Config/ExportExcelTemplate/sysLoginperson_account.json +++ b/dsBaseRpc/Config/ExportExcelTemplate/sysLoginperson_account_city.json @@ -1,5 +1,5 @@ { - "title": "单位管理员账号", + "title": "市级机构管理员账号", "cols": [ { "col_name": "序号", diff --git a/dsBaseRpc/Config/ExportExcelTemplate/sysLoginperson_account_district.json b/dsBaseRpc/Config/ExportExcelTemplate/sysLoginperson_account_district.json new file mode 100644 index 00000000..e242b27b --- /dev/null +++ b/dsBaseRpc/Config/ExportExcelTemplate/sysLoginperson_account_district.json @@ -0,0 +1,25 @@ +{ + "title": "区县级机构管理员账号", + "cols": [ + { + "col_name": "序号", + "col_field": "number", + "width": 15 + }, + { + "col_name": "管理员名称", + "col_field": "person_name", + "width": 40 + }, + { + "col_name": "登录名", + "col_field": "login_name", + "width": 30 + }, + { + "col_name": "初始密码", + "col_field": "original_pwd", + "width": 20 + } + ] +} \ No newline at end of file diff --git a/dsBaseRpc/Config/ImportExcelTemplate/student.xlsx b/dsBaseRpc/Config/ImportExcelTemplate/student.xlsx index 67a1bde5..8c3d4ece 100644 Binary files a/dsBaseRpc/Config/ImportExcelTemplate/student.xlsx and b/dsBaseRpc/Config/ImportExcelTemplate/student.xlsx differ diff --git a/dsBaseRpc/Config/ImportExcelTemplate/teacher2222.xlsx b/dsBaseRpc/Config/ImportExcelTemplate/teacher2222.xlsx new file mode 100644 index 00000000..4caac5a3 Binary files /dev/null and b/dsBaseRpc/Config/ImportExcelTemplate/teacher2222.xlsx differ diff --git a/dsBaseRpc/Linux上安装Go环境+配置DLV.txt b/dsBaseRpc/Linux上安装Go环境+配置DLV.txt index 1b276290..dde83b53 100644 --- a/dsBaseRpc/Linux上安装Go环境+配置DLV.txt +++ b/dsBaseRpc/Linux上安装Go环境+配置DLV.txt @@ -23,4 +23,8 @@ go get github.com/go-delve/delve/cmd/dlv # Goland配置方法 https://www.jianshu.com/p/e74e940a64d9 -dlv --listen=:2345 --headless=true --api-version=2 exec ./dsBaseRpc \ No newline at end of file +dlv --listen=:2345 --headless=true --api-version=2 exec ./dsBaseRpc + + +//构建一个强制转换的错误~~~~ +//panic(400) diff --git a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go index 54483c5b..0ca220f4 100644 --- a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go +++ b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go @@ -10,7 +10,6 @@ import ( "dsBaseRpc/Utils/SqlKit" "dsBaseRpc/models" "errors" - "fmt" "github.com/xormplus/builder" "strings" "time" @@ -169,10 +168,6 @@ func PageBaseOrganization(in *BaseOrganizationProto.QueryArg) ([]map[string]inte //通过SQL获取带缓存的数据 list, count, err := SqlKit.QueryForPk(sql) - //构建一个强制转换的错误~~~~ - fmt.Println(list[0]["bureau_id"].(int64)) - - //修改密码的显示项目 SysLoginpersonDao.FillPwd(&list) return list, count, err diff --git a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go index c760790c..a60573d8 100644 --- a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go +++ b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go @@ -206,7 +206,7 @@ func ExportStudentInfoExcel(targetPath string, bureauId string, ExportExcelStatu if ExportExcelStatus > 0 { //将现有数据填充到下载的模板中 var myBuilder = builder.Dialect(builder.MYSQL).Select(`t2.stage_id,t2.rxnf,t2.bh,t1.xm, - (case t1.sfzjh when '-1' then '' else t1.sfzjh end ) as sfzjh, + (case t1.sfzjh when '-1' then '' else t1.sfzjh end ) as sfzjh, t1.mzm,t1.zzmmm,t1.sfzjlxm,t1.dszybz,t1.sqznbz,t1.jcwgrysqznbz, t1.gebz,t1.lsetbz,t1.cjbz`). From("t_base_student as t1").InnerJoin("t_base_class as t2", "t1.class_id=t2.class_id"). diff --git a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go index bb2d0ef5..13303ef2 100644 --- a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go +++ b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go @@ -270,14 +270,14 @@ func ExportTeacherInfoExcel(targetPath string, bureauId string, ExportExcelStatu } //学段限定 dvRange := excelize.NewDataValidation(true) - dvRange.Sqref = "K" + CommonUtil.ConvertIntToString(ExcelUtil.HiddenRows+2) + ":L" + CommonUtil.ConvertIntToString(ExcelUtil.RowsCount+ExcelUtil.HiddenRows) + dvRange.Sqref = "K" + CommonUtil.ConvertIntToString(ExcelUtil.HiddenRows+2) + ":K" + CommonUtil.ConvertIntToString(ExcelUtil.RowsCount+ExcelUtil.HiddenRows) dvRange.SetSqrefDropList("$"+startDictCName+"$1:$"+stopDictCName+"$1", true) f.AddDataValidation(SheetName, dvRange) //学科级联绑定 dvRange = excelize.NewDataValidation(true) - dvRange.Sqref = "L" + CommonUtil.ConvertIntToString(2+ExcelUtil.HiddenRows) + ":M" + CommonUtil.ConvertIntToString(ExcelUtil.RowsCount+ExcelUtil.HiddenRows) - dvRange.SetSqrefDropList("INDIRECT($L"+CommonUtil.ConvertIntToString(ExcelUtil.HiddenRows+2)+")", true) + dvRange.Sqref = "L" + CommonUtil.ConvertIntToString(2+ExcelUtil.HiddenRows) + ":L" + CommonUtil.ConvertIntToString(ExcelUtil.RowsCount+ExcelUtil.HiddenRows) + dvRange.SetSqrefDropList("INDIRECT($K"+CommonUtil.ConvertIntToString(ExcelUtil.HiddenRows+2)+")", true) f.AddDataValidation(SheetName, dvRange) //部门 diff --git a/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonService/SysLoginpersonService.go b/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonService/SysLoginpersonService.go index 3c599da4..baacdb3c 100644 --- a/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonService/SysLoginpersonService.go +++ b/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonService/SysLoginpersonService.go @@ -255,8 +255,13 @@ func (s *Rpc) PageSysLoginpersonExcel(ctx context.Context, in *SysLoginpersonPro LogUtil.Error(ErrorConst.SqlQueryError, "执行PageSysLoginperson时发生严重错误:"+err.Error()) return &reply, err } - //1、配置文件 - jsonTemplate := "sysLoginperson_account.json" + //6位,我们需要取最后两位 + //配置文件 + jsonTemplate := "sysLoginperson_account_city.json" + //如果是县区,那么修改一下配置文件名称 + if in.AreaCode[4:6]!="00" { + jsonTemplate = "sysLoginperson_account_district.json" + } //2、导出 TargetPath := CommonUtil.GetExportExcelFilePath() ExcelUtil.ExportExcel(jsonTemplate, list, TargetPath) diff --git a/dsBaseRpc/Test/excel_test.go b/dsBaseRpc/Test/excel_test.go index 6ed7e6fa..55c5278e 100644 --- a/dsBaseRpc/Test/excel_test.go +++ b/dsBaseRpc/Test/excel_test.go @@ -1,24 +1,21 @@ package Test import ( - "dsBaseRpc/Const" "dsBaseRpc/RpcService/BaseStudent/BaseStudentDao" - "dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao" - "github.com/360EntSecGroup-Skylar/excelize/v2" "testing" ) func TestStyle(t *testing.T) { - excelPath := `E:\Work\dsMin\dsBaseRpc\Config\ImportExcelTemplate\teacher.xlsx` - tPath := `E:\Work\dsMin\dsBaseRpc\Config\ImportExcelTemplate\teacher2222.xlsx` - f, _ := excelize.OpenFile(excelPath) - - style, _ := f.GetCellStyle("教工信息", Const.RedCell) - f.SetCellStyle("教工信息", "A202", "A202", style) - - if err := f.SaveAs(tPath); err != nil { - println(err.Error()) - } + //excelPath := `E:\Work\dsMin\dsBaseRpc\Config\ImportExcelTemplate\teacher.xlsx` + //tPath := `E:\Work\dsMin\dsBaseRpc\Config\ImportExcelTemplate\teacher2222.xlsx` + //f, _ := excelize.OpenFile(excelPath) + // + //style, _ := f.GetCellStyle("教工信息", Const.RedCell) + //f.SetCellStyle("教工信息", "A202", "A202", style) + // + //if err := f.SaveAs(tPath); err != nil { + // println(err.Error()) + //} } func TestImportTeacher(t *testing.T) { @@ -41,10 +38,10 @@ func TestImportTeacher(t *testing.T) { */ func TestTeacherExportExcel(t *testing.T) { //哪个单位 - bureauId := "042F28BE-296C-40F4-8AD4-A68A6D852CF0" - //文件在哪里 - fileName := "E:\\Work\\dsMin\\dsBaseWeb\\Html\\ExcelTemp\\" + bureauId + ".xlsx" - BaseTeacherDao.ExportTeacherInfoExcel(fileName, bureauId, 1) + //bureauId := "042F28BE-296C-40F4-8AD4-A68A6D852CF0" + ////文件在哪里 + //fileName := "E:\\Work\\dsMin\\dsBaseWeb\\Html\\ExcelTemp\\" + bureauId + ".xlsx" + //BaseTeacherDao.ExportTeacherInfoExcel(fileName, bureauId, 1) } /** @@ -54,7 +51,7 @@ func TestTeacherExportExcel(t *testing.T) { */ func TestStudentExportExcel(t *testing.T) { //哪个单位 - bureauId := "042F28BE-296C-40F4-8AD4-A68A6D852CF0" + bureauId := "7ED4080B-924F-40F0-9004-881A2B833E44" //文件在哪里 fileName := "E:\\Work\\dsMin\\dsBaseWeb\\Html\\ExcelTemp\\" + bureauId + ".xlsx" BaseStudentDao.ExportStudentInfoExcel(fileName, bureauId, 1, []string{}) diff --git a/dsBaseWeb/Html/ExcelTemp/7ED4080B-924F-40F0-9004-881A2B833E44.xlsx b/dsBaseWeb/Html/ExcelTemp/7ED4080B-924F-40F0-9004-881A2B833E44.xlsx new file mode 100644 index 00000000..4a7a8f48 Binary files /dev/null and b/dsBaseWeb/Html/ExcelTemp/7ED4080B-924F-40F0-9004-881A2B833E44.xlsx differ