From 1cfa4cac5b5a9b036b52b476942fd12063c519b0 Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Wed, 19 Aug 2020 07:49:25 +0800 Subject: [PATCH] 'commit' --- .../BaseStudentDao/BaseStudentDao.go | 38 +++++++++++-------- .../BaseTeacherDao/BaseTeacherDao.go | 3 ++ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go index 37644f3e..77eafb89 100644 --- a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go +++ b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go @@ -165,7 +165,7 @@ func ExportStudentInfoExcel(targetPath string, bureauId string, ExportExcelStatu //2、添加批注 f.AddComment(SheetName, "B201", `{"author":"示例: ","text":"填写年份全称,如:2019 或 2020。"}`) f.AddComment(SheetName, "C201", `{"author":"示例: ","text":"填写本年级内班级的编号,如:1或2,代表本年级内的1班或2班。"}`) - + f.AddComment(SheetName, "F201", `{"author":"示例: ","text":"1980-01-01"}`) //3、入学年份+班号的有效性 for k := 2 + ExcelUtil.HiddenRows; k <= 5000+ExcelUtil.HiddenRows; k++ { //入学年份 @@ -181,8 +181,8 @@ func ExportStudentInfoExcel(targetPath string, bureauId string, ExportExcelStatu dvRange.SetError(excelize.DataValidationErrorStyleStop, "班号录入错误", "系统只支持1-99的班号!") f.AddDataValidation(SheetName, dvRange) } - //4、添加是否的下拉框L--->N - for i := 9; i <= 14; i++ { + //4、添加是否的下拉框K--->P + for i := 11; i <= 16; i++ { //要设置下拉框的列 cName, _ := excelize.ColumnNumberToName(i) dvRange := excelize.NewDataValidation(true) @@ -204,7 +204,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, + var myBuilder = builder.Dialect(builder.MYSQL).Select(`t2.stage_id,t2.rxnf,t2.bh,t1.xm,t1.xbm,t1.csrq, (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`). @@ -224,6 +224,12 @@ func ExportStudentInfoExcel(targetPath string, bureauId string, ExportExcelStatu } for i := range list { record := list[i] + //扩展性别 + if record["xbm"].(string) == "2" { + record["xbm"] = "男" + } else { + record["xbm"] = "女" + } //扩展学段 record["stage_name"] = SysDictKit.MapStageIdToName[record["stage_id"].(string)] //扩展民族 @@ -246,7 +252,7 @@ func ExportStudentInfoExcel(targetPath string, bureauId string, ExportExcelStatu record["cjbz"] = SysDictKit.MapTrueOrFalseValueToName[CommonUtil.ConvertInt64ToString(record["cjbz"].(int64))] } //填充 - var colNames = []string{"stage_name", "rxnf", "bh", "xm", "mzm", "zzmmm", "sfzjlxm", "sfzjh", "dszybz", "sqznbz", "jcwgrysqznbz", "gebz", "lsetbz", "cjbz"} + var colNames = []string{"stage_name", "rxnf", "bh", "xm", "xbm", "csrq", "mzm", "zzmmm", "sfzjlxm", "sfzjh", "dszybz", "sqznbz", "jcwgrysqznbz", "gebz", "lsetbz", "cjbz"} for i := range list { for j := range colNames { cName, _ := excelize.ColumnNumberToName(j + 1) @@ -262,10 +268,10 @@ func ExportStudentInfoExcel(targetPath string, bureauId string, ExportExcelStatu } //导入本校学生信息 -func ImportStudentInfoExcel(excelPath string, bureauId string,actionPersonId string,actionIp string) (bool, string, error) { +func ImportStudentInfoExcel(excelPath string, bureauId string, actionPersonId string, actionIp string) (bool, string, error) { //判断文件是不是存在 if !FileUtil.PathExists(excelPath) { - return false, "03", nil //03:文件没有找到 + return false, "03", nil //03:文件没有找到 } //模板是不是系统提供的 var templateSuccess = true @@ -320,10 +326,10 @@ func ImportStudentInfoExcel(excelPath string, bureauId string,actionPersonId str insertOrUpdateFlagSetting(batchId) //6、新增 - insertCount, _, _ = insertStudent(batchId, bureauModel,actionPersonId,actionIp) + insertCount, _, _ = insertStudent(batchId, bureauModel, actionPersonId, actionIp) //7、修改 - updateCount, _, _ = updateStudentImport(batchId, bureauModel,actionPersonId,actionIp) + updateCount, _, _ = updateStudentImport(batchId, bureauModel, actionPersonId, actionIp) return true, "插入" + CommonUtil.ConvertIntToString(insertCount) + "条记录,更新" + CommonUtil.ConvertIntToString(updateCount) + "条记录!", nil } @@ -671,7 +677,7 @@ func insertOrUpdateFlagSetting(batchId string) { /** 功能:插入学生 */ -func insertStudent(batchId string, bureauModel models.TBaseOrganization,actionPersonId string,actionIp string) (int, string, error) { +func insertStudent(batchId string, bureauModel models.TBaseOrganization, actionPersonId string, actionIp string) (int, string, error) { //新增学生 studentImportExcelArray := make([]models.TBaseStudentImportExcel, 0) studentArray := make([]models.TBaseStudent, 0) @@ -745,7 +751,7 @@ func insertStudent(batchId string, bureauModel models.TBaseOrganization,actionPe return 0, Const.DataBaseActionError, err } //生成日志 - ActionLog(studentArray,Const.ActionInsert,actionPersonId,actionIp) + ActionLog(studentArray, Const.ActionInsert, actionPersonId, actionIp) //产生登录名 accountArray := SysLoginpersonService.GenerateLoginAccount(3, int64(len(studentImportExcelArray))) var loginpersonModels = make([]models.TSysLoginperson, 0) @@ -777,7 +783,7 @@ func insertStudent(batchId string, bureauModel models.TBaseOrganization,actionPe /** 功能:更新导入的学生 */ -func updateStudentImport(batchId string, bureauModel models.TBaseOrganization,actionPersonId string,actionIp string) (int, string, error) { +func updateStudentImport(batchId string, bureauModel models.TBaseOrganization, actionPersonId string, actionIp string) (int, string, error) { //准备身份证号与人员id的映射map sql := `select t1.person_id,t1.sfzjh from t_base_student as t1 inner join t_base_student_import_excel as t2 on t1.sfzjh=t2.sfzjh where t2.batch_id=?` @@ -874,12 +880,12 @@ func updateStudentImport(batchId string, bureauModel models.TBaseOrganization,ac return 0, Const.DataBaseActionError, err } //生成日志 - var studentIds=make([]string,0) + var studentIds = make([]string, 0) for i := range studentArray { - studentIds= append(studentIds, studentArray[i].PersonId) + studentIds = append(studentIds, studentArray[i].PersonId) } ms, err := GetByIds(studentIds) - ActionLog(ms,Const.ActionUpdate,actionPersonId,actionIp) + ActionLog(ms, Const.ActionUpdate, actionPersonId, actionIp) //删除缓存 for i := range studentArray { @@ -907,5 +913,5 @@ func GetParentIds(studentIds []string) ([]string, error) { for i := range list { parentIds = append(parentIds, list[i]["person_id"].(string)) } - return parentIds,nil + return parentIds, nil } diff --git a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go index 05858b7e..da9ab0ef 100644 --- a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go +++ b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go @@ -296,6 +296,9 @@ func ExportTeacherInfoExcel(targetPath string, bureauId string, ExportExcelStatu //1、配置文件 jsonTemplate := "teacher.json" f, s1, dictCols, SheetName := ExcelUtil.TemplateAddDict("teacher.xlsx", jsonTemplate) + //添加注释 + f.AddComment(SheetName, "D201", `{"author":"示例: ","text":"1980-01-01"}`) + //数据准备 list, _ := db.SQL(s1.Level2Sql[0][0]).Query().List() //初始列