From a7adb3c2ac5942bebb47c2b1af9f486bdb9d3c47 Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Fri, 25 Sep 2020 17:10:11 +0800 Subject: [PATCH] 'commit' --- ...StyleIntNormal.json => tableStyleInt.json} | 66 +++++++++---------- .../BaseStudentDao/BaseStudentDao.go | 48 +++++++++----- 2 files changed, 63 insertions(+), 51 deletions(-) rename dsBaseRpc/Config/ExcelStyle/{tableStyleIntNormal.json => tableStyleInt.json} (93%) diff --git a/dsBaseRpc/Config/ExcelStyle/tableStyleIntNormal.json b/dsBaseRpc/Config/ExcelStyle/tableStyleInt.json similarity index 93% rename from dsBaseRpc/Config/ExcelStyle/tableStyleIntNormal.json rename to dsBaseRpc/Config/ExcelStyle/tableStyleInt.json index 7bbff5b8..29325b37 100644 --- a/dsBaseRpc/Config/ExcelStyle/tableStyleIntNormal.json +++ b/dsBaseRpc/Config/ExcelStyle/tableStyleInt.json @@ -1,34 +1,34 @@ -{ - "font": { - "family": "宋体", - "size": 14, - "color": "#000000" - }, - "alignment": { - "horizontal": "center", - "vertical": "center" - }, - "number_format": 1, - "border": [ - { - "type": "left", - "color": "000000", - "style": 1 - }, - { - "type": "right", - "color": "000000", - "style": 1 - }, - { - "type": "top", - "color": "000000", - "style": 1 - }, - { - "type": "bottom", - "color": "000000", - "style": 1 - } - ] +{ + "font": { + "family": "宋体", + "size": 14, + "color": "#000000" + }, + "alignment": { + "horizontal": "center", + "vertical": "center" + }, + "number_format": 1, + "border": [ + { + "type": "left", + "color": "000000", + "style": 1 + }, + { + "type": "right", + "color": "000000", + "style": 1 + }, + { + "type": "top", + "color": "000000", + "style": 1 + }, + { + "type": "bottom", + "color": "000000", + "style": 1 + } + ] } \ No newline at end of file diff --git a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go index 697c5a6c..e118b3ed 100644 --- a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go +++ b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go @@ -180,25 +180,37 @@ func ExportStudentInfoExcel(targetPath string, bureauId string, ExportExcelStatu _ = 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"}`) + + //整数类型 + var stylePathPrefix = "./Config/ExcelStyle/" + tableStyleIntPath := stylePathPrefix + "tableStyleInt.json" + if !FileUtil.PathExists(tableStyleIntPath) { + tableStyleIntPath = "." + tableStyleIntPath + } + tableStyleIntStyle, _ := f.NewStyle(FileUtil.ReadFileContent(tableStyleIntPath)) + //3、入学年份+班号的有效性 - //for k := 2 + ExcelUtil.HiddenRows; k <= 5000+ExcelUtil.HiddenRows; k++ { - // //入学年份 - // dvRange := excelize.NewDataValidation(true) - // dvRange.Sqref = "B" + CommonUtil.ConvertIntToString(k) + ":B" + CommonUtil.ConvertIntToString(k) - // _ = dvRange.SetRange(2014, 2030, excelize.DataValidationTypeWhole, excelize.DataValidationOperatorBetween) - // dvRange.SetError(excelize.DataValidationErrorStyleStop, "入学年份校验错误", "系统只支持2014-2030年度的班级!") - // _ = f.AddDataValidation(SheetName, dvRange) - // //设置单元格格式 - // - // //班号 - // dvRange = excelize.NewDataValidation(true) - // dvRange.Sqref = "C" + CommonUtil.ConvertIntToString(k) + ":C" + CommonUtil.ConvertIntToString(k) - // _ = dvRange.SetRange(1, 99, excelize.DataValidationTypeWhole, excelize.DataValidationOperatorBetween) - // dvRange.SetError(excelize.DataValidationErrorStyleStop, "班号录入错误", "系统只支持1-99的班号!") - // _ = f.AddDataValidation(SheetName, dvRange) - // //设置单元格格式 - // - //} + for k := 2 + ExcelUtil.HiddenRows; k <= 5000+ExcelUtil.HiddenRows; k++ { + //入学年份 + dvRange := excelize.NewDataValidation(true) + dvRange.Sqref = "B" + CommonUtil.ConvertIntToString(k) + ":B" + CommonUtil.ConvertIntToString(k) + _ = dvRange.SetRange(2014, 2030, excelize.DataValidationTypeWhole, excelize.DataValidationOperatorBetween) + dvRange.SetError(excelize.DataValidationErrorStyleStop, "入学年份校验错误", "系统只支持2014-2030年度的班级!") + _ = f.AddDataValidation(SheetName, dvRange) + //设置单元格格式 + cName:="B"+CommonUtil.ConvertIntToString(k) + f.SetCellStyle(SheetName, cName, cName, tableStyleIntStyle) + + //班号 + dvRange = excelize.NewDataValidation(true) + dvRange.Sqref = "C" + CommonUtil.ConvertIntToString(k) + ":C" + CommonUtil.ConvertIntToString(k) + _ = dvRange.SetRange(1, 99, excelize.DataValidationTypeWhole, excelize.DataValidationOperatorBetween) + dvRange.SetError(excelize.DataValidationErrorStyleStop, "班号录入错误", "系统只支持1-99的班号!") + _ = f.AddDataValidation(SheetName, dvRange) + //设置单元格格式 + cName="C"+CommonUtil.ConvertIntToString(k) + f.SetCellStyle(SheetName, cName, cName, tableStyleIntStyle) + } //4、添加是否的下拉框K--->P for i := 11; i <= 16; i++ { //要设置下拉框的列