diff --git a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go index a60573d8..7d6ea7a0 100644 --- a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go +++ b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go @@ -266,7 +266,7 @@ func ExportStudentInfoExcel(targetPath string, bureauId string, ExportExcelStatu func ImportStudentInfoExcel(excelPath string, bureauId string,actionPersonId string,actionIp string) (bool, string, error) { //判断文件是不是存在 if !FileUtil.PathExists(excelPath) { - return false, "文件没有找到", nil + return false, "03", nil //03:文件没有找到 } //模板是不是系统提供的 var templateSuccess = true @@ -295,7 +295,7 @@ func ImportStudentInfoExcel(excelPath string, bureauId string,actionPersonId str //1、对模板的合法性进行检查 templateSuccess = ExcelUtil.IsValidTemplate(excelPath, s1) if !templateSuccess { - return false, "不是系统提供的模板,无法完成导入!", nil + return false, "01", nil //01:不是系统提供的模板,无法完成导入! } //2、对excel的合法性进行检查 excelSuccess = checkExcel(excelPath, s1, MapClass, MapStage) @@ -310,7 +310,7 @@ func ImportStudentInfoExcel(excelPath string, bureauId string,actionPersonId str //两个有一个不成功,则提示 if !excelSuccess || !mysqlSuccess { - return false, "在excel检测中,发现问题,请检查后重新上传!", nil + return false, "02", nil //02:在excel检测中,发现问题,请检查后重新上传! } //4、获取所有单位的一些属性,用于一会维护人员信息时使用 diff --git a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go index 13303ef2..05257161 100644 --- a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go +++ b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go @@ -355,7 +355,7 @@ func ExportTeacherInfoExcel(targetPath string, bureauId string, ExportExcelStatu func ImportTeacherInfoExcel(excelPath string, bureauId string, actionPersonId string, actionIp string) (bool, string, error) { //判断文件是不是存在 if !FileUtil.PathExists(excelPath) { - return false, "文件没有找到", nil + return false, "03", nil //03:文件没有找到 } //模板是不是系统提供的 var templateSuccess = true @@ -381,7 +381,7 @@ func ImportTeacherInfoExcel(excelPath string, bureauId string, actionPersonId st //1、对模板的合法性进行检查 templateSuccess = ExcelUtil.IsValidTemplate(excelPath, s1) if !templateSuccess { - return false, "不是系统提供的模板,无法完成导入!", nil + return false, "01", nil //01:不是系统提供的模板,无法完成导入! } //2、对excel的合法性进行检查 excelSuccess = checkExcel(excelPath, s1, MapOrgName) @@ -394,7 +394,7 @@ func ImportTeacherInfoExcel(excelPath string, bureauId string, actionPersonId st //两个有一个不成功,则提示 if !excelSuccess || !mysqlSuccess { - return false, "在excel检测中,发现问题,请检查后重新上传!", nil + return false, "02", nil //02:在excel检测中,发现问题,请检查后重新上传! } //4、获取所有单位的一些属性,用于一会维护人员信息时使用 diff --git a/dsBaseRpc/Test/excel_test.go b/dsBaseRpc/Test/excel_test.go index 55c5278e..d6e8940f 100644 --- a/dsBaseRpc/Test/excel_test.go +++ b/dsBaseRpc/Test/excel_test.go @@ -2,6 +2,7 @@ package Test import ( "dsBaseRpc/RpcService/BaseStudent/BaseStudentDao" + "fmt" "testing" ) @@ -50,22 +51,22 @@ func TestTeacherExportExcel(t *testing.T) { 时间:2020-06-05 */ func TestStudentExportExcel(t *testing.T) { - //哪个单位 - bureauId := "7ED4080B-924F-40F0-9004-881A2B833E44" - //文件在哪里 - fileName := "E:\\Work\\dsMin\\dsBaseWeb\\Html\\ExcelTemp\\" + bureauId + ".xlsx" - BaseStudentDao.ExportStudentInfoExcel(fileName, bureauId, 1, []string{}) + ////哪个单位 + //bureauId := "7ED4080B-924F-40F0-9004-881A2B833E44" + ////文件在哪里 + //fileName := "E:\\Work\\dsMin\\dsBaseWeb\\Html\\ExcelTemp\\" + bureauId + ".xlsx" + //BaseStudentDao.ExportStudentInfoExcel(fileName, bureauId, 1, []string{}) } func TestImportStudent(t *testing.T) { - ////哪个单位 - //bureauId := "042F28BE-296C-40F4-8AD4-A68A6D852CF0" - ////文件在哪里 - //fileName := `E:\Work\dsMin\dsBaseWeb\html\ExcelTemp\` + bureauId + ".xlsx" - //success, message, err := BaseStudentDao.ImportStudentInfoExcel(fileName, bureauId) - //if err != nil { - // fmt.Println(err.Error()) - //} - //fmt.Println(success) - //fmt.Println(message) + //哪个单位 + bureauId := "4763978F-D464-4A3F-93D4-9857668D10A7" + //文件在哪里 + fileName := `E:\Work\dsMin\dsBaseWeb\Html\ExcelTemp\` + bureauId + ".xlsx" + success, message, err := BaseStudentDao.ImportStudentInfoExcel(fileName, bureauId,"B4A8ED19-84DB-4388-BD3D-25BACD463119","10.10.24.100") + if err != nil { + fmt.Println(err.Error()) + } + fmt.Println(success) + fmt.Println(message) } diff --git a/dsBaseWeb/Html/ExcelTemp/4763978F-D464-4A3F-93D4-9857668D10A7.xlsx b/dsBaseWeb/Html/ExcelTemp/4763978F-D464-4A3F-93D4-9857668D10A7.xlsx new file mode 100644 index 00000000..3cad745d Binary files /dev/null and b/dsBaseWeb/Html/ExcelTemp/4763978F-D464-4A3F-93D4-9857668D10A7.xlsx differ