master
huanghai 5 years ago
parent dfd12eb699
commit 1b5d2b5a69

@ -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、获取所有单位的一些属性用于一会维护人员信息时使用

@ -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、获取所有单位的一些属性用于一会维护人员信息时使用

@ -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)
}

Loading…
Cancel
Save