@PostMapping("/importExcel")
public R importExcel(@RequestBody(required = true) MultipartFile file){
return service.importExcel(file);
}
@Override
@Transactional(rollbackFor = Exception.class)
public R importExcel(MultipartFile file) {
TimeInterval timer = DateUtil.timer();
//系统部门
EntityWrapper<Organize> entityWrapper = new EntityWrapper<>();
entityWrapper.eq("IS_DELETED",0);
entityWrapper.setSqlSelect("ID","NAME");
List<Organize> organizeList = organizeService.selectList(entityWrapper);
Map<String, Long> deptNameIdMap = organizeList.stream().filter(x -> StrUtil.isNotBlank(x.getName())).collect(Collectors.toMap(Organize::getName, Organize::getId, (x, y) -> x));
Long userId = ShiroUtils.getCurrentUser().getUserId();
Long orgId = ShiroUtils.getCurrentUser().getMainOrg();
//系统目录
List<CatalogSystem> catalogSystemList = CollUtil.newArrayList();
//系统功能清单
List<CatalogSystemInformation> informationList = CollUtil.newArrayList();
//等保测评记录
List<CatalogSystemTestRecord> recordList = CollUtil.newArrayList();
//报错信息list
List<JSONObject> errorList = CollUtil.newArrayList();
//表头是否被修改
List<JSONObject> errorHeadList = CollUtil.newArrayList();
//模板要是.xlsx以及全部字段类型是string=cellType=1
if (file == null) {
JSONObject obj = new JSONObject();
obj.put("code", "300");
obj.put("data", "请选择excel");
return R.ok(obj);
}
//校验是否为xlsx
String fileIsXlsx = this.checkIsXlsx(file);
if (StrUtil.isNotBlank(fileIsXlsx)) {
JSONObject obj = new JSONObject();
obj.put("code", "300");
obj.put("data", fileIsXlsx);
return R.ok(obj);
}
XSSFWorkbook xssfWorkbook = null;
try {
InputStream inputStream = file.getInputStream();
xssfWorkbook = new XSSFWorkbook(inputStream);
} catch (IOException e) {
JSONObject obj = new JSONObject();
obj.put("code", "300");
obj.put("data", "创建文件输入流失败");
return R.ok(obj);
}
// 获取Excel的第一个sheet
XSSFSheet sheetAt = xssfWorkbook.getSheetAt(0);
boolean excelIsEmpty = true;
//获取行数
int columnNum = this.getRealRow(sheetAt)+2;
// System.out.println("*****"+columnNum);
for (int i = 0; i < columnNum; i++) {
//获取每行数据
Row row = sheetAt.getRow(i);
if (i <= 1) {
//表头一共62列 验证表头是否被修改
if (i == 1) {
for (int j = 0; j < 62; j++) {
Cell cell = row.getCell(j);
if (cell == null || cell.getCellType() != 1 || StrUtil.isBlank(cell.getStringCellValue()) || !cell.getStringCellValue().equals(idNameMap.get(j + 1))) {
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", "此单元格表头被修改,表头应为:" + idNameMap.get(j + 1));
errorHeadList.add(errorObj);
}
}
}
} else {
if (errorHeadList.size() > 0) {
JSONObject obj = new JSONObject();
obj.put("code", "100");
obj.put("data", errorHeadList);
return R.ok(obj);
}
//下面是数据
//获取列数 一共是62列
int lastRowNum = row.getPhysicalNumberOfCells();
if (lastRowNum != 0) {
String randomId = UUID.randomUUID().toString();
CatalogSystem catalogSystem = new CatalogSystem();
//数据来源 3-系统导入
catalogSystem.setDataSource("3");
catalogSystem.setUserId(userId);
catalogSystem.setOrgId(orgId);
catalogSystem.setRandomId(randomId);
//备案状态 systemApplicationState 默认编辑中 {dicKey: '1', dicValue: '审核中'},{dicKey: '2', dicValue: '已备案'},{dicKey: '4', dicValue: '被驳回'},{dicKey: '5', dicValue: '编辑中'}
catalogSystem.setSystemApplicationState("5");
//下面这些居然要导入多条,目前先指定个数目吧 设置为5
//部门信息的 归口业务处室 本单位业务负责人 本单位业务系统负责人联系电话 本单位业务系统负责人电子邮箱
CatalogSystemInformation info1 = new CatalogSystemInformation();
info1.setNeedAdd("2");
info1.setRandomId(randomId);
info1.setInformationType("1");
info1.setUserId(userId);
info1.setOrgId(orgId);
info1.setCreateTime(LocalDateTime.now());
info1.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info11 = new CatalogSystemInformation();
info11.setNeedAdd("2");
info11.setRandomId(randomId);
info11.setInformationType("1");
info11.setUserId(userId);
info11.setOrgId(orgId);
info11.setCreateTime(LocalDateTime.now());
info11.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info12 = new CatalogSystemInformation();
info12.setNeedAdd("2");
info12.setRandomId(randomId);
info12.setInformationType("1");
info12.setUserId(userId);
info12.setOrgId(orgId);
info12.setCreateTime(LocalDateTime.now());
info12.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info13 = new CatalogSystemInformation();
info13.setNeedAdd("2");
info13.setRandomId(randomId);
info13.setInformationType("1");
info13.setUserId(userId);
info13.setOrgId(orgId);
info13.setCreateTime(LocalDateTime.now());
info13.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info14 = new CatalogSystemInformation();
info14.setNeedAdd("2");
info14.setRandomId(randomId);
info14.setInformationType("1");
info14.setUserId(userId);
info14.setOrgId(orgId);
info14.setCreateTime(LocalDateTime.now());
info14.setModifiedTime(LocalDateTime.now());
//部门信息的 安全主管领导、主管领导联系方式 catalog_system_information 表 INFORMATION_TYPE=2
CatalogSystemInformation info2 = new CatalogSystemInformation();
info2.setNeedAdd("2");
info2.setRandomId(randomId);
info2.setInformationType("2");
info2.setUserId(userId);
info2.setOrgId(orgId);
info2.setCreateTime(LocalDateTime.now());
info2.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info21 = new CatalogSystemInformation();
info21.setNeedAdd("2");
info21.setRandomId(randomId);
info21.setInformationType("2");
info21.setUserId(userId);
info21.setOrgId(orgId);
info21.setCreateTime(LocalDateTime.now());
info21.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info22 = new CatalogSystemInformation();
info22.setNeedAdd("2");
info22.setRandomId(randomId);
info22.setInformationType("2");
info22.setUserId(userId);
info22.setOrgId(orgId);
info22.setCreateTime(LocalDateTime.now());
info22.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info23 = new CatalogSystemInformation();
info23.setNeedAdd("2");
info23.setRandomId(randomId);
info23.setInformationType("2");
info23.setUserId(userId);
info23.setOrgId(orgId);
info23.setCreateTime(LocalDateTime.now());
info23.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info24 = new CatalogSystemInformation();
info24.setNeedAdd("2");
info24.setRandomId(randomId);
info24.setInformationType("2");
info24.setUserId(userId);
info24.setOrgId(orgId);
info24.setCreateTime(LocalDateTime.now());
info24.setModifiedTime(LocalDateTime.now());
//部门信息的 安全责任人、责任人联系方式
CatalogSystemInformation info3 = new CatalogSystemInformation();
info3.setNeedAdd("2");
info3.setRandomId(randomId);
info3.setInformationType("3");
info3.setUserId(userId);
info3.setOrgId(orgId);
info3.setCreateTime(LocalDateTime.now());
info3.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info31 = new CatalogSystemInformation();
info31.setNeedAdd("2");
info31.setRandomId(randomId);
info31.setInformationType("3");
info31.setUserId(userId);
info31.setOrgId(orgId);
info31.setCreateTime(LocalDateTime.now());
info31.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info32 = new CatalogSystemInformation();
info32.setNeedAdd("2");
info32.setRandomId(randomId);
info32.setInformationType("3");
info32.setUserId(userId);
info32.setOrgId(orgId);
info32.setCreateTime(LocalDateTime.now());
info32.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info33 = new CatalogSystemInformation();
info33.setNeedAdd("2");
info33.setRandomId(randomId);
info33.setInformationType("3");
info33.setUserId(userId);
info33.setOrgId(orgId);
info33.setCreateTime(LocalDateTime.now());
info33.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info34 = new CatalogSystemInformation();
info34.setNeedAdd("2");
info34.setRandomId(randomId);
info34.setInformationType("3");
info34.setUserId(userId);
info34.setOrgId(orgId);
info34.setCreateTime(LocalDateTime.now());
info34.setModifiedTime(LocalDateTime.now());
//等保测评 catalog_system_test_reocrd
CatalogSystemTestRecord catalogSystemTestRecord = new CatalogSystemTestRecord();
catalogSystemTestRecord.setNeedAdd("2");
catalogSystemTestRecord.setRandomId(randomId);
catalogSystemTestRecord.setUserId(userId);
catalogSystemTestRecord.setOrgId(orgId);
catalogSystemTestRecord.setCreateTime(LocalDateTime.now());
catalogSystemTestRecord.setModifiedTime(LocalDateTime.now());
CatalogSystemTestRecord catalogSystemTestRecord1 = new CatalogSystemTestRecord();
catalogSystemTestRecord1.setNeedAdd("2");
catalogSystemTestRecord1.setRandomId(randomId);
catalogSystemTestRecord1.setUserId(userId);
catalogSystemTestRecord1.setOrgId(orgId);
catalogSystemTestRecord1.setCreateTime(LocalDateTime.now());
catalogSystemTestRecord1.setModifiedTime(LocalDateTime.now());
CatalogSystemTestRecord catalogSystemTestRecord2 = new CatalogSystemTestRecord();
catalogSystemTestRecord2.setNeedAdd("2");
catalogSystemTestRecord2.setRandomId(randomId);
catalogSystemTestRecord2.setUserId(userId);
catalogSystemTestRecord2.setOrgId(orgId);
catalogSystemTestRecord2.setCreateTime(LocalDateTime.now());
catalogSystemTestRecord2.setModifiedTime(LocalDateTime.now());
CatalogSystemTestRecord catalogSystemTestRecord3 = new CatalogSystemTestRecord();
catalogSystemTestRecord3.setNeedAdd("2");
catalogSystemTestRecord3.setRandomId(randomId);
catalogSystemTestRecord3.setUserId(userId);
catalogSystemTestRecord3.setOrgId(orgId);
catalogSystemTestRecord3.setCreateTime(LocalDateTime.now());
catalogSystemTestRecord3.setModifiedTime(LocalDateTime.now());
CatalogSystemTestRecord catalogSystemTestRecord4 = new CatalogSystemTestRecord();
catalogSystemTestRecord4.setNeedAdd("2");
catalogSystemTestRecord4.setRandomId(randomId);
catalogSystemTestRecord4.setUserId(userId);
catalogSystemTestRecord4.setOrgId(orgId);
catalogSystemTestRecord4.setCreateTime(LocalDateTime.now());
catalogSystemTestRecord4.setModifiedTime(LocalDateTime.now());
//系统开发厂商 4
CatalogSystemInformation info4 = new CatalogSystemInformation();
info4.setNeedAdd("2");
info4.setRandomId(randomId);
info4.setInformationType("4");
info4.setUserId(userId);
info4.setOrgId(orgId);
info4.setCreateTime(LocalDateTime.now());
info4.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info41 = new CatalogSystemInformation();
info41.setNeedAdd("2");
info41.setRandomId(randomId);
info41.setInformationType("4");
info41.setUserId(userId);
info41.setOrgId(orgId);
info41.setCreateTime(LocalDateTime.now());
info41.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info42 = new CatalogSystemInformation();
info42.setNeedAdd("2");
info42.setRandomId(randomId);
info42.setInformationType("4");
info42.setUserId(userId);
info42.setOrgId(orgId);
info42.setCreateTime(LocalDateTime.now());
info42.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info43 = new CatalogSystemInformation();
info43.setNeedAdd("2");
info43.setRandomId(randomId);
info43.setInformationType("4");
info43.setUserId(userId);
info43.setOrgId(orgId);
info43.setCreateTime(LocalDateTime.now());
info43.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info44= new CatalogSystemInformation();
info44.setNeedAdd("2");
info44.setRandomId(randomId);
info44.setInformationType("4");
info44.setUserId(userId);
info44.setOrgId(orgId);
info44.setCreateTime(LocalDateTime.now());
info44.setModifiedTime(LocalDateTime.now());
//系统运营厂商 5
CatalogSystemInformation info5 = new CatalogSystemInformation();
info5.setNeedAdd("2");
info5.setRandomId(randomId);
info5.setInformationType("5");
info5.setUserId(userId);
info5.setOrgId(orgId);
info5.setCreateTime(LocalDateTime.now());
info5.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info51 = new CatalogSystemInformation();
info51.setNeedAdd("2");
info51.setRandomId(randomId);
info51.setInformationType("5");
info51.setUserId(userId);
info51.setOrgId(orgId);
info51.setCreateTime(LocalDateTime.now());
info51.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info52 = new CatalogSystemInformation();
info52.setNeedAdd("2");
info52.setRandomId(randomId);
info52.setInformationType("5");
info52.setUserId(userId);
info52.setOrgId(orgId);
info52.setCreateTime(LocalDateTime.now());
info52.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info53 = new CatalogSystemInformation();
info53.setNeedAdd("2");
info53.setRandomId(randomId);
info53.setInformationType("5");
info53.setUserId(userId);
info53.setOrgId(orgId);
info53.setCreateTime(LocalDateTime.now());
info53.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info54 = new CatalogSystemInformation();
info54.setNeedAdd("2");
info54.setRandomId(randomId);
info54.setInformationType("5");
info54.setUserId(userId);
info54.setOrgId(orgId);
info54.setCreateTime(LocalDateTime.now());
info54.setModifiedTime(LocalDateTime.now());
//安全开发厂商 6
CatalogSystemInformation info6 = new CatalogSystemInformation();
info6.setNeedAdd("2");
info6.setRandomId(randomId);
info6.setInformationType("6");
info6.setUserId(userId);
info6.setOrgId(orgId);
info6.setCreateTime(LocalDateTime.now());
info6.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info61 = new CatalogSystemInformation();
info61.setNeedAdd("2");
info61.setRandomId(randomId);
info61.setInformationType("6");
info61.setUserId(userId);
info61.setOrgId(orgId);
info61.setCreateTime(LocalDateTime.now());
info61.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info62 = new CatalogSystemInformation();
info62.setNeedAdd("2");
info62.setRandomId(randomId);
info62.setInformationType("6");
info62.setUserId(userId);
info62.setOrgId(orgId);
info62.setCreateTime(LocalDateTime.now());
info62.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info63 = new CatalogSystemInformation();
info63.setNeedAdd("2");
info63.setRandomId(randomId);
info63.setInformationType("6");
info63.setUserId(userId);
info63.setOrgId(orgId);
info63.setCreateTime(LocalDateTime.now());
info63.setModifiedTime(LocalDateTime.now());
CatalogSystemInformation info64 = new CatalogSystemInformation();
info64.setNeedAdd("2");
info64.setRandomId(randomId);
info64.setInformationType("6");
info64.setUserId(userId);
info64.setOrgId(orgId);
info64.setCreateTime(LocalDateTime.now());
info64.setModifiedTime(LocalDateTime.now());
lastRowNum = 62;
for (int j = 0; j < lastRowNum; j++) {
//单元格
Cell cell = row.getCell(j);
if (cell != null) {
//第i行第j列的值(模板用string数值,如果用其他类型则用其他方法获取值)
// int CELL_TYPE_NUMERIC = 0;
// int CELL_TYPE_STRING = 1;
// int CELL_TYPE_FORMULA = 2;
// int CELL_TYPE_BLANK = 3;
// int CELL_TYPE_BOOLEAN = 4;
// int CELL_TYPE_ERROR = 5;
int cellType = cell.getCellType();
if (cellType != 1 && cellType != 3) {
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格请调整为文本格式");
errorList.add(errorObj);
} else {
String cellValue = cell.getStringCellValue();
if (StrUtil.isNotBlank(cellValue)) {
cellValue = cellValue.trim();
excelIsEmpty = false;
// 校验每个cell 要判断长度、字典等
switch (j) {
//信息系统名称* name 512
case 0:
if (cellValue.length() > 512) {
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过512");
errorList.add(errorObj);
} else {
catalogSystem.setName(cellValue);
catalogSystem.setOthersystem(cellValue);
}
break;
//信息系统类型 systemTypeInformation 255 字典 1-Web 2-App 3-小程序 4-H5 5-其他 6-办公运行类系统 7-业务应用类系统 8-宣传微博/微信公众号 9-门户网站
case 1:
catalogSystem.setSystemTypeInformation(systemTypeInformationMap.getOrDefault(cellValue, ""));
break;
//系统所属部门* SYS_ORG 用简称匹配
case 2:
Long deptId = deptNameIdMap.get(cellValue);
if (deptId != null){
catalogSystem.setSysOrg(deptId);
}else{
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":系统不存在部门:"+cellValue);
errorList.add(errorObj);
}
break;
//系统应用领域* areaName CATALOG_AREA_NAME 01-健康保障 02-社会保障 03-食品药品安全 09-营商环境 04-安全生产
//10-政务服务 05-价格监管 11-社会经济 06-信用体系 12-公共民生 07-工作参考 08-城乡建设 14-其他
case 3:
catalogSystem.setAreaName(areaNameMap.getOrDefault(cellValue, ""));
break;
//建设方式 buildType varchar1 1-部门自建 2-省级统建 3-国家统建
case 4:
catalogSystem.setBuildType(buildTypeMap.getOrDefault(cellValue,""));
break;
//系统功能清单* 崔确认用 ^ 分隔 放在功能名称里面
case 5:
String[] split = cellValue.split("\\^");
if (split != null && split.length > 0){
boolean bo = true;
for (String str : split) {
if (StrUtil.isNotBlank(str)){
if (str.length()<=255){
CatalogSystemInformation c = new CatalogSystemInformation();
c.setInformationType("7");
c.setUserId(userId);
c.setOrgId(orgId);
c.setCreateTime(LocalDateTime.now());
c.setModifiedTime(LocalDateTime.now());
c.setRandomId(randomId);
c.setName(str);
informationList.add(c);
}else{
if (bo){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":单个名称长度不能超过255");
errorList.add(errorObj);
bo=false;
}
}
}
}
}
break;
//系统组件清单
case 6:
String[] zjqnSplit = cellValue.split("\\^");
if (zjqnSplit != null && zjqnSplit.length > 0){
boolean boZjqd = true;
for (String str : zjqnSplit) {
if (StrUtil.isNotBlank(str)){
if (str.length()<=255){
CatalogSystemInformation c = new CatalogSystemInformation();
c.setInformationType("8");
c.setUserId(userId);
c.setOrgId(orgId);
c.setCreateTime(LocalDateTime.now());
c.setModifiedTime(LocalDateTime.now());
c.setRandomId(randomId);
c.setName(str);
informationList.add(c);
}else{
if (boZjqd){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":单个名称长度不能超过255");
errorList.add(errorObj);
boZjqd=false;
}
}
}
}
}
break;
//项目立项名称 projectName varchar 500
case 7:
if (cellValue.length() > 500){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过500");
errorList.add(errorObj);
}else{
catalogSystem.setProjectName(cellValue);
}
break;
//项目批复文号 projectApprovalNo varchar 500
case 8:
if (cellValue.length() > 500){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过500");
errorList.add(errorObj);
}else{
catalogSystem.setProjectApprovalNo(cellValue);
}
break;
//项目立项审批部门 projectApprovalDepartment varchar 255
case 9:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setProjectApprovalDepartment(cellValue);
}
break;
//项目立项审批日期 projectApprovalDate varchar 255
case 10:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setProjectApprovalDate(cellValue);
}
break;
//预算项目名称 budgetItemName varchar 255
case 11:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setBudgetItemName(cellValue);
}
break;
//预算涉及的年度起 budgetBeginYear varchar 255
case 12:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setBudgetBeginYear(cellValue);
}
break;
//预算涉及的年度止 budgetEndYear varchar 255
case 13:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setBudgetEndYear(cellValue);
}
break;
//部门信息的归口业务处室、本单位业务负责人、本单位业务系统负责人联系电话、本单位业务系统负责人电子邮箱 是 catalog_system_information
//的informationType=1的数据 归口业务处室=CONTACT_INFORMATION 本单位业务负责人=name 本单位业务系统负责人联系电话=contact 本单位业务系统负责人电子邮箱=email
//归口业务处室 CONTACT_INFORMATION varchar255
case 14:
String[] split1 = cellValue.split("\\^");
for (String str : split1) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split1.length; k++) {
String str = split1[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info1.setNeedAdd("1");
info1.setContactInformation(str);
}
if (k==1){
info11.setNeedAdd("1");
info11.setContactInformation(str);
}
if (k==2){
info12.setNeedAdd("1");
info12.setContactInformation(str);
}
if (k==3){
info13.setNeedAdd("1");
info13.setContactInformation(str);
}
if (k==4){
info14.setNeedAdd("1");
info14.setContactInformation(str);
}
}
}
break;
//本单位业务负责人* name varchar 255
case 15:
String[] split2 = cellValue.split("\\^");
for (String str : split2) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split2.length; k++) {
String str = split2[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info1.setNeedAdd("1");
info1.setName(str);
}
if (k==1){
info11.setNeedAdd("1");
info11.setName(str);
}
if (k==2){
info12.setNeedAdd("1");
info12.setName(str);
}
if (k==3){
info13.setNeedAdd("1");
info13.setName(str);
}
if (k==4){
info14.setNeedAdd("1");
info14.setName(str);
}
}
}
break;
//本单位业务系统负责人联系电话* contact varchar 255
case 16:
String[] split3 = cellValue.split("\\^");
for (String str : split3) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split3.length; k++) {
String str = split3[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info1.setNeedAdd("1");
info1.setContact(str);
}
if (k==1){
info11.setNeedAdd("1");
info11.setContact(str);
}
if (k==2){
info12.setNeedAdd("1");
info12.setContact(str);
}
if (k==3){
info13.setNeedAdd("1");
info13.setContact(str);
}
if (k==4){
info14.setNeedAdd("1");
info14.setContact(str);
}
}
}
break;
//本单位业务系统负责人电子邮箱* email varchar 255
case 17:
String[] split4 = cellValue.split("\\^");
for (String str : split4) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split4.length; k++) {
String str = split4[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info1.setNeedAdd("1");
info1.setEmail(str);
}
if (k==1){
info11.setNeedAdd("1");
info11.setEmail(str);
}
if (k==2){
info12.setNeedAdd("1");
info12.setEmail(str);
}
if (k==3){
info13.setNeedAdd("1");
info13.setEmail(str);
}
if (k==4){
info14.setNeedAdd("1");
info14.setEmail(str);
}
}
}
break;
//部门信息的 安全主管领导、主管领导联系方式 字段是 catalog_system_information表INFORMATION_TYPE=2的数据
//安全主管领导-name 主管领导联系方式-CONTACT
//安全主管领导
case 18:
String[] split5 = cellValue.split("\\^");
for (String str : split5) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split5.length; k++) {
String str = split5[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info2.setNeedAdd("1");
info2.setName(str);
}
if (k==1){
info21.setNeedAdd("1");
info21.setName(str);
}
if (k==2){
info22.setNeedAdd("1");
info22.setName(str);
}
if (k==3){
info23.setNeedAdd("1");
info23.setName(str);
}
if (k==4){
info24.setNeedAdd("1");
info24.setName(str);
}
}
}
break;
//主管领导联系方式 -CONTACT
case 19:
String[] split6 = cellValue.split("\\^");
for (String str : split6) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split6.length; k++) {
String str = split6[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info2.setNeedAdd("1");
info2.setContact(str);
}
if (k==1){
info21.setNeedAdd("1");
info21.setContact(str);
}
if (k==2){
info22.setNeedAdd("1");
info22.setContact(str);
}
if (k==3){
info23.setNeedAdd("1");
info23.setContact(str);
}
if (k==4){
info24.setNeedAdd("1");
info24.setContact(str);
}
}
}
break;
//安全责任人 name 责任人联系方式 cantact
case 20:
String[] split7 = cellValue.split("\\^");
for (String str : split7) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split7.length; k++) {
String str = split7[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info3.setNeedAdd("1");
info3.setName(str);
}
if (k==1){
info31.setNeedAdd("1");
info31.setName(str);
}
if (k==2){
info32.setNeedAdd("1");
info32.setName(str);
}
if (k==3){
info33.setNeedAdd("1");
info33.setName(str);
}
if (k==4){
info34.setNeedAdd("1");
info34.setName(str);
}
}
}
break;
//责任人联系方式 cantact
case 21:
String[] split8 = cellValue.split("\\^");
for (String str : split8) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split8.length; k++) {
String str = split8[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info3.setNeedAdd("1");
info3.setContact(str);
}
if (k==1){
info31.setNeedAdd("1");
info31.setContact(str);
}
if (k==2){
info32.setNeedAdd("1");
info32.setContact(str);
}
if (k==3){
info33.setNeedAdd("1");
info33.setContact(str);
}
if (k==4){
info34.setNeedAdd("1");
info34.setContact(str);
}
}
}
break;
//是否为僵尸系统* isCorpse 1-是0-否
case 22:
if (cellValue.equals("是")){
catalogSystem.setIsCorpse("1");
}
if (cellValue.equals("否")){
catalogSystem.setIsCorpse("0");
}
break;
//系统开始使用日期* systemStartDate varchar 255
case 23:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setSystemStartDate(cellValue);
}
break;
//系统停止使用日期* systemEndDate varchar 255
case 24:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setSystemEndDate(cellValue);
}
break;
//系统状态* systemStatus-字典 SYSTEN_STATE 1-建设中(终验前) 2-运行中(终验后) 3-停用 4-其他
case 25:
catalogSystem.setSystemStatus(systemStatusMap.getOrDefault(cellValue,""));
break;
//建设资金来源 sourceConstructionFunds 字典 SOURCE_OF_CONSTRUCTION_FUNDS
//1-上级配套 2-财政 3-单位自筹 4-其他(如捐赠) 5-无 6-中央财政 7-省级财政 8-市县财政收入 9-单位自有资金
case 26:
catalogSystem.setSourceConstructionFunds(sourceConstructionFundsMap.getOrDefault(cellValue,""));
break;
//使用范围-区域* region USE_RANGE_AREA 1-省 2-市 3-县(区) 4-乡(镇) 5-行政村(社区) 6-无
case 27:
catalogSystem.setRegion(regionMap.getOrDefault(cellValue,""));
break;
//使用范围-用户 subscriber SCOPE_OF_USE_USER 1-处室内部 2-本部门本级 3-系统内地方各级 4-社会公众
//5-其他 6-厅本级(省本级) 7-跨部门用户
case 28:
catalogSystem.setSubscriber(subscriberMap.getOrDefault(cellValue,""));
break;
//建设层级* constructionLevel CONSTRUCTION_LEVEL 1-国家 2-省级 3-市级 4-县(市、区)
case 29:
catalogSystem.setConstructionLevel(constructionLevelMap.getOrDefault(cellValue,""));
break;
//对外提供的ip provideIp varchar15
case 30:
if (cellValue.length() > 15){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过15");
errorList.add(errorObj);
}else{
catalogSystem.setProvideIp(cellValue);
}
break;
//对外提供的URL地址* provideUrl varchar 255
case 31:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setProvideUrl(cellValue);
}
break;
//是否在用其它部门数据 departmentsBeingUsed
case 32:
if (cellValue.equals("是")){
catalogSystem.setDepartmentsBeingUsed("1");
}
if (cellValue.equals("否")){
catalogSystem.setDepartmentsBeingUsed("0");
}
break;
//是否有独立app* isIndependent
case 33:
if (cellValue.equals("是")){
catalogSystem.setIsIndependent("1");
}
if (cellValue.equals("否")){
catalogSystem.setIsIndependent("0");
}
break;
//活跃度* liveness VARCHAR 255
case 34:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setLiveness(cellValue);
}
break;
//安全服务类型: securityServiceType SECURITY_SERVICE_TYPE 1-安全咨询 2-风险评估 3-安全测评
//4-安全加固 5-应急响应 6-其他 7-无
case 35:
catalogSystem.setSecurityServiceType(securityServiceTypeMap.getOrDefault(cellValue,""));
break;
//系统部署情况* systemDeployment SYSTEM_DEPLOYMENT varchar 255
//1-自建机房 2-租用机房 3-政务云 4-第三方云 5-无部署
case 36:
catalogSystem.setSystemDeployment(systemDeploymentMap.getOrDefault(cellValue,""));
break;
case 37:
//未上政务云原因 notGoingReasons varchar 255
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setNotGoingReasons(cellValue);
}
break;
case 38:
//上政务云时间计划 goingReasonsTime varchar 255
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setGoingReasonsTime(cellValue);
}
break;
//网络环境 networkEnvironment CATA_NETWORK 1-政务内网 2-政务外网 3-互联网 4-业务专网 5-单机
case 39:
catalogSystem.setNetworkEnvironment(networkEnvironmentMap.getOrDefault(cellValue,""));
break;
//数据库格式 databaseFormat CATA_DB_FORMAT 1-My SQL 2-MS SQL 3-Oracle 4-Sybase 5-DB2 6-Hbase 7-Access 8-其他
case 40:
catalogSystem.setDatabaseFormat(databaseFormatMap.getOrDefault(cellValue,""));
break;
//数据规模(G)* dataScale varchar 255
case 41:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setDataScale(cellValue);
}
break;
//数据总量(条) totalData varchar 255
case 42:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setTotalData(cellValue);
}
break;
//数据月增长情况(M)* monthlyGrowth varchar 255
case 43:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setMonthlyGrowth(cellValue);
}
break;
//存量数据时间范围* dataTimeRange varchar 255
case 44:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setDataTimeRange(cellValue);
}
break;
//等级保护 gradeProtection GRADE_PROTECTION 1-一级 2-二级 3-三级 4-四级 5-五级 6-未备案
case 45:
catalogSystem.setGradeProtection(gradeProtectionMap.getOrDefault(cellValue,""));
break;
//等保备案机关 filingAuthority varchar 255
case 46:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setFilingAuthority(cellValue);
}
break;
//等保备案时间 filingAuthorityTime varchar 255
case 47:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setFilingAuthorityTime(cellValue);
}
break;
//等保备案编号 filingNo varchar 255
case 48:
if (cellValue.length() > 255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格长度不能超过255");
errorList.add(errorObj);
}else{
catalogSystem.setFilingNo(cellValue);
}
break;
//等保测评机构 catalog_system_test_record'ORGANIZATION varchar 255
case 49:
String[] split9 = cellValue.split("\\^");
for (String str : split9) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split9.length; k++) {
String str = split9[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
catalogSystemTestRecord.setNeedAdd("1");
catalogSystemTestRecord.setOrganization(str);
}
if (k==1){
catalogSystemTestRecord1.setNeedAdd("1");
catalogSystemTestRecord1.setOrganization(str);
}
if (k==2){
catalogSystemTestRecord2.setNeedAdd("1");
catalogSystemTestRecord2.setOrganization(str);
}
if (k==3){
catalogSystemTestRecord3.setNeedAdd("1");
catalogSystemTestRecord3.setOrganization(str);
}
if (k==4){
catalogSystemTestRecord4.setNeedAdd("1");
catalogSystemTestRecord4.setOrganization(str);
}
}
}
break;
//等保测评时间 catalog_system_test_record'TEST_TIME varchar 32
case 50:
String[] split10 = cellValue.split("\\^");
for (String str : split10) {
if (str.length() >32){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过32");
errorList.add(errorObj);
}
}
for (int k = 0; k < split10.length; k++) {
String str = split10[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
catalogSystemTestRecord.setNeedAdd("1");
catalogSystemTestRecord.setTestTime(str);
}
if (k==1){
catalogSystemTestRecord1.setNeedAdd("1");
catalogSystemTestRecord1.setTestTime(str);
}
if (k==2){
catalogSystemTestRecord2.setNeedAdd("1");
catalogSystemTestRecord2.setTestTime(str);
}
if (k==3){
catalogSystemTestRecord3.setNeedAdd("1");
catalogSystemTestRecord3.setTestTime(str);
}
if (k==4){
catalogSystemTestRecord4.setNeedAdd("1");
catalogSystemTestRecord4.setTestTime(str);
}
}
}
break;
// //等保测评得分 catalog_system_test_record'SCORE varchar 6
case 51:
String[] split11 = cellValue.split("\\^");
for (String str : split11) {
if (str.length() >6){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过6");
errorList.add(errorObj);
}
}
for (int k = 0; k < split11.length; k++) {
String str = split11[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
catalogSystemTestRecord.setNeedAdd("1");
catalogSystemTestRecord.setScore(str);
}
if (k==1){
catalogSystemTestRecord1.setNeedAdd("1");
catalogSystemTestRecord1.setScore(str);
}
if (k==2){
catalogSystemTestRecord2.setNeedAdd("1");
catalogSystemTestRecord2.setScore(str);
}
if (k==3){
catalogSystemTestRecord3.setNeedAdd("1");
catalogSystemTestRecord3.setScore(str);
}
if (k==4){
catalogSystemTestRecord4.setNeedAdd("1");
catalogSystemTestRecord4.setScore(str);
}
}
}
break;
//是否有密码测评 isPasswordAssessment
case 52:
if (cellValue.equals("是")){
catalogSystem.setIsPasswordAssessment("1");
}
if (cellValue.equals("否")){
catalogSystem.setIsPasswordAssessment("0");
}
break;
//系统开发厂商 MANUFACTURER_NAME
case 53:
String[] split12 = cellValue.split("\\^");
for (String str : split12) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split12.length; k++) {
String str = split12[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info4.setNeedAdd("1");
info4.setManufacturerName(str);
}
if (k==1){
info41.setNeedAdd("1");
info41.setManufacturerName(str);
}
if (k==2){
info42.setNeedAdd("1");
info42.setManufacturerName(str);
}
if (k==3){
info43.setNeedAdd("1");
info43.setManufacturerName(str);
}
if (k==4){
info44.setNeedAdd("1");
info44.setManufacturerName(str);
}
}
}
break;
//开发厂商联系人 name
case 54:
String[] split13 = cellValue.split("\\^");
for (String str : split13) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split13.length; k++) {
String str = split13[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info4.setNeedAdd("1");
info4.setName(str);
}
if (k==1){
info41.setNeedAdd("1");
info41.setName(str);
}
if (k==2){
info42.setNeedAdd("1");
info42.setName(str);
}
if (k==3){
info43.setNeedAdd("1");
info43.setName(str);
}
if (k==4){
info44.setNeedAdd("1");
info44.setName(str);
}
}
}
break;
//开发厂商联系方式 contact
case 55:
String[] split14 = cellValue.split("\\^");
for (String str : split14) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split14.length; k++) {
String str = split14[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info4.setNeedAdd("1");
info4.setContact(str);
}
if (k==1){
info41.setNeedAdd("1");
info41.setContact(str);
}
if (k==2){
info42.setNeedAdd("1");
info42.setContact(str);
}
if (k==3){
info43.setNeedAdd("1");
info43.setContact(str);
}
if (k==4){
info44.setNeedAdd("1");
info44.setContact(str);
}
}
}
break;
case 56:
String[] split15 = cellValue.split("\\^");
for (String str : split15) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split15.length; k++) {
String str = split15[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info5.setNeedAdd("1");
info5.setManufacturerName(str);
}
if (k==1){
info51.setNeedAdd("1");
info51.setManufacturerName(str);
}
if (k==2){
info52.setNeedAdd("1");
info52.setManufacturerName(str);
}
if (k==3){
info53.setNeedAdd("1");
info53.setManufacturerName(str);
}
if (k==4){
info54.setNeedAdd("1");
info54.setManufacturerName(str);
}
}
}
break;
case 57:
String[] split16 = cellValue.split("\\^");
for (String str : split16) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split16.length; k++) {
String str = split16[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info5.setNeedAdd("1");
info5.setName(str);
}
if (k==1){
info51.setNeedAdd("1");
info51.setName(str);
}
if (k==2){
info52.setNeedAdd("1");
info52.setName(str);
}
if (k==3){
info53.setNeedAdd("1");
info53.setName(str);
}
if (k==4){
info54.setNeedAdd("1");
info54.setName(str);
}
}
}
break;
case 58:
String[] split17 = cellValue.split("\\^");
for (String str : split17) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split17.length; k++) {
String str = split17[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info5.setNeedAdd("1");
info5.setContact(str);
}
if (k==1){
info51.setNeedAdd("1");
info51.setContact(str);
}
if (k==2){
info52.setNeedAdd("1");
info52.setContact(str);
}
if (k==3){
info53.setNeedAdd("1");
info53.setContact(str);
}
if (k==4){
info54.setNeedAdd("1");
info54.setContact(str);
}
}
}
break;
case 59:
String[] split18 = cellValue.split("\\^");
for (String str : split18) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split18.length; k++) {
String str = split18[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info6.setNeedAdd("1");
info6.setManufacturerName(str);
}
if (k==1){
info61.setNeedAdd("1");
info61.setManufacturerName(str);
}
if (k==2){
info62.setNeedAdd("1");
info62.setManufacturerName(str);
}
if (k==3){
info63.setNeedAdd("1");
info63.setManufacturerName(str);
}
if (k==4){
info64.setNeedAdd("1");
info64.setManufacturerName(str);
}
}
}
break;
case 60:
String[] split19 = cellValue.split("\\^");
for (String str : split19) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split19.length; k++) {
String str = split19[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info6.setNeedAdd("1");
info6.setName(str);
}
if (k==1){
info61.setNeedAdd("1");
info61.setName(str);
}
if (k==2){
info62.setNeedAdd("1");
info62.setName(str);
}
if (k==3){
info63.setNeedAdd("1");
info63.setName(str);
}
if (k==4){
info64.setNeedAdd("1");
info64.setName(str);
}
}
}
break;
case 61:
String[] split20 = cellValue.split("\\^");
for (String str : split20) {
if (str.length() >255){
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此单元格单个要素长度不能超过255");
errorList.add(errorObj);
}
}
for (int k = 0; k < split20.length; k++) {
String str = split20[k];
if (StrUtil.isNotBlank(str)){
if (k==0){
info6.setNeedAdd("1");
info6.setContact(str);
}
if (k==1){
info61.setNeedAdd("1");
info61.setContact(str);
}
if (k==2){
info62.setNeedAdd("1");
info62.setContact(str);
}
if (k==3){
info63.setNeedAdd("1");
info63.setContact(str);
}
if (k==4){
info64.setNeedAdd("1");
info64.setContact(str);
}
}
}
break;
default:
break;
}
} else {
if (CollUtil.newArrayList(1, 2, 3, 4, 5, 6, 16, 17, 18, 23, 24, 25, 26, 28, 29, 30, 31, 32, 34, 37, 42, 44, 45).contains(Integer.valueOf(j + 1))) {
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此项必填,不能为空");
errorList.add(errorObj);
}
}
// System.out.println("第" + (i + 1) + "行第" + (j + 1) + "列数值为:" + cellValue + "类型为" + cell.getCellType());
}
} else {
// 获取每列 要判断lastRowNum是否够最后一个必填以及cell类型以及必填验证以及长度等
//1,2,3,4,5,6,16,17,18,23,24,25,26,28,29,30,31,32,35,37,42,44,45必填 -23一共23个
if (CollUtil.newArrayList(1, 2, 3, 4, 5, 6, 16, 17, 18, 23, 24, 25, 26, 28, 29, 30, 31, 32, 34, 37, 42, 44, 45).contains(Integer.valueOf(j + 1))) {
JSONObject errorObj = new JSONObject();
errorObj.put("sheet", "sheet1");
errorObj.put("row", (i + 1));
errorObj.put("cell", Integer.valueOf(j + 1).toString());
errorObj.put("errMsg", idNameMap.get(j + 1) + ":此项必填,不能为空");
errorList.add(errorObj);
}
}
}
//添加数据
catalogSystemList.add(catalogSystem);
if (info1.getNeedAdd().equals("1")){
informationList.add(info1);
}
if (info11.getNeedAdd().equals("1")){
informationList.add(info11);
}
if (info12.getNeedAdd().equals("1")){
informationList.add(info12);
}
if (info13.getNeedAdd().equals("1")){
informationList.add(info13);
}
if (info14.getNeedAdd().equals("1")){
informationList.add(info14);
}
if (info2.getNeedAdd().equals("1")){
informationList.add(info2);
}
if (info21.getNeedAdd().equals("1")){
informationList.add(info21);
}
if (info22.getNeedAdd().equals("1")){
informationList.add(info22);
}
if (info23.getNeedAdd().equals("1")){
informationList.add(info23);
}
if (info24.getNeedAdd().equals("1")){
informationList.add(info24);
}
if (info3.getNeedAdd().equals("1")){
informationList.add(info3);
}
if (info31.getNeedAdd().equals("1")){
informationList.add(info31);
}
if (info32.getNeedAdd().equals("1")){
informationList.add(info32);
}
if (info33.getNeedAdd().equals("1")){
informationList.add(info33);
}
if (info34.getNeedAdd().equals("1")){
informationList.add(info34);
}
if (catalogSystemTestRecord.getNeedAdd().equals("1")){
recordList.add(catalogSystemTestRecord);
}
if (catalogSystemTestRecord1.getNeedAdd().equals("1")){
recordList.add(catalogSystemTestRecord1);
}
if (catalogSystemTestRecord2.getNeedAdd().equals("1")){
recordList.add(catalogSystemTestRecord2);
}
if (catalogSystemTestRecord3.getNeedAdd().equals("1")){
recordList.add(catalogSystemTestRecord3);
}
if (catalogSystemTestRecord4.getNeedAdd().equals("1")){
recordList.add(catalogSystemTestRecord4);
}
if (info4.getNeedAdd().equals("1")){
informationList.add(info4);
}
if (info41.getNeedAdd().equals("1")){
informationList.add(info41);
}
if (info42.getNeedAdd().equals("1")){
informationList.add(info42);
}
if (info43.getNeedAdd().equals("1")){
informationList.add(info43);
}
if (info44.getNeedAdd().equals("1")){
informationList.add(info44);
}
if (info5.getNeedAdd().equals("1")){
informationList.add(info5);
}
if (info51.getNeedAdd().equals("1")){
informationList.add(info51);
}
if (info52.getNeedAdd().equals("1")){
informationList.add(info52);
}
if (info53.getNeedAdd().equals("1")){
informationList.add(info53);
}
if (info54.getNeedAdd().equals("1")){
informationList.add(info54);
}
if (info6.getNeedAdd().equals("1")){
informationList.add(info6);
}
if (info61.getNeedAdd().equals("1")){
informationList.add(info61);
}
if (info62.getNeedAdd().equals("1")){
informationList.add(info62);
}
if (info63.getNeedAdd().equals("1")){
informationList.add(info63);
}
if (info64.getNeedAdd().equals("1")){
informationList.add(info64);
}
}
}
}
if (excelIsEmpty) {
JSONObject obj = new JSONObject();
obj.put("code", "300");
obj.put("data", "excel内容不能为空");
return R.ok(obj);
}
if (errorList.size() > 0) {
JSONObject obj = new JSONObject();
obj.put("code", "100");
obj.put("data", errorList);
return R.ok(obj);
} else {
System.out.println("本次导入到插入数据花费时间(毫秒):"+timer.interval());
// 插入数据
if (catalogSystemList.size() > 0){
/**
*
*/
// catalogSystemService.insertBatch(catalogSystemList);
catalogSystemList.forEach(x ->{
catalogSystemService.insertNolog(x);
});
Map<String, Long> randomIdMap = catalogSystemList.stream().collect(Collectors.toMap(CatalogSystem::getRandomId, CatalogSystem::getId, (x, y) -> x));
if (informationList.size() > 0){
informationList.forEach(x ->{
x.setSystemId(randomIdMap.get(x.getRandomId()));
catalogSystemInformationService.insert(x);
});
// catalogSystemInformationService.insertBatch(informationList);
}
if (recordList.size() > 0){
recordList.forEach(x -> {
x.setSystemId(randomIdMap.get(x.getRandomId()));
recordMapper.insert(x);
});
// recordService.insertBatch(recordList);
}
}
}
System.out.println("本次导入花费时间(毫秒):"+timer.intervalRestart());
return R.ok();
}