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