Skip to content

Commit

Permalink
v 2.3.0 GA
Browse files Browse the repository at this point in the history
  • Loading branch information
shimingxy committed Nov 11, 2020
1 parent 2928bff commit a44022b
Show file tree
Hide file tree
Showing 23 changed files with 473 additions and 167 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
当前版本百度网盘下载,<a href="https://maxkey.top/zh/download.html" target="_blank"> 历史版本</a>
| 版本 | 日期 | 下载地址 | 提取码 |
| --------| :----- | :---- | :----: |
| v 2.2.0 GA | 2020/09/24 | <a href="https://pan.baidu.com/s/1gtgELidq1F-GwvmxKbY_oA" target="_blank">链接下载</a> | **0y9o** |
| v 2.3.0 GA | 2020/11/11 | <a href="https://pan.baidu.com/s/17jAatKNlM6L649992kEMBQ" target="_blank">链接下载</a> | **h3zw** |


# Roadmap
Expand Down
30 changes: 19 additions & 11 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
MaxKey v 2.3.0 GA 2020/11/**
MaxKey v 2.3.0 GA 2020/11/12
*(MAXKEY-200901) 基于spring session的集群会话共享功能
*(MAXKEY-200902) 单点注销功能,应用可以配置为NONE/BACK_CHANNEL/FRONT_CHANNEL三种方式,支持CAS/SAML/Default
*(MAXKEY-200903) 用户在线实时更新功能
*(MAXKEY-200904) 批量Excel用户导入功能
*(MAXKEY-200905) 用户注册功能
*(MAXKEY-200906) 用户状态修改
*(MAXKEY-200907) 用户详情显示问题
*(MAXKEY-200908) 应用修改时数字大于4为长度格式化问题
*(MAXKEY-200904) 定制用户模板,实现批量Excel用户导入功能
*(MAXKEY-200905) 定制机构模板,实现批量Excel机构导入功能
*(MAXKEY-200906) 用户注册功能
*(MAXKEY-200907) 用户状态修改
*(MAXKEY-200908) 用户详情显示问题
*(MAXKEY-200909) 应用修改时数字大于4为长度格式化问题
*(MAXKEY-200910) 注销后,点击重新登陆跳转问题
*(MAXKEY-200911) 增加SP登录跳转功能,支持knox的认证
*(MAXKEY-200912) 构建脚本的优化和更新
*(MAXKEY-200913) 权限控制 RoleAdministrators
*(MAXKEY-200913) 管理员权限控制 RoleAdministrators
*(MAXKEY-200914) 社交账号登录优化
*(MAXKEY-200915) 列表界面中未”选择“情况下,弹出界面错误
*(MAXKEY-200916) jib(docker) 支持 ,感谢https://github.com/alanland
*(MAXKEY-200916) 登录过程的优化
*(MAXKEY-200917) 认证的优化,支持@Principal的注入
*(MAXKEY-200918) 应用单点登录时,用户访问权限控制
*(MAXKEY-200920) 依赖jar引用、更新和升级
*(MAXKEY-200917) 登录过程的优化
*(MAXKEY-200918) 认证的优化,支持@Principal的注入
*(MAXKEY-200919) 应用单点登录时,用户访问权限控制
*(MAXKEY-200920) maxkey-mgt 项目配置文件的验证码启用不启用配置未生效
*(MAXKEY-200921) 登录图标改进
*(MAXKEY-200922) 官方网站的优化
*(MAXKEY-200923) 依赖jar引用、更新和升级
druid 1.2.1
JustAuth 1.15.8
simple-http 1.0.3
spring-session 2.3.1.RELEASE
druid-spring-boot-starter 1.2.1
xmlbeans 3.0.1
commons-compress 1.20
poi 4.1.2
commons-collections4 4.4

MaxKey v 2.2.0 GA 2020/09/24
*(MAXKEY-200801) 官方网站内容调整,初步增加英文版支持,增加新闻、合作伙伴及与CAS等开源产品对比
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group =maxkey.top
version =2.2.0.RELEASE
version =2.3.0.RELEASE
vendor =https://www.maxkey.top
author =shimingxy
#Version For use jar
Expand Down
11 changes: 11 additions & 0 deletions maxkey-core/src/main/java/org/maxkey/domain/ExcelImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class ExcelImport extends JpaBaseDomain {

@JsonIgnore
protected MultipartFile excelFile;


String updateExist;

public ExcelImport() {
super();
Expand All @@ -57,6 +60,14 @@ public void setId(String id) {
this.id = id;
}

public String getUpdateExist() {
return updateExist;
}

public void setUpdateExist(String updateExist) {
this.updateExist = updateExist;
}

public MultipartFile getExcelFile() {
return excelFile;
}
Expand Down
12 changes: 12 additions & 0 deletions maxkey-core/src/main/java/org/maxkey/domain/Organizations.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public class Organizations extends JpaBaseDomain implements Serializable {
private String sortIndex;
@Column
private String description;

private String status;

public Organizations() {
// TODO Auto-generated constructor stub
Expand Down Expand Up @@ -286,6 +288,16 @@ public String getSortIndex() {
public void setSortIndex(String sortIndex) {
this.sortIndex = sortIndex;
}



public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,33 @@

package org.maxkey.persistence.service;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;

import org.apache.mybatis.jpa.persistence.JpaBaseService;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.maxkey.domain.Organizations;
import org.maxkey.identity.kafka.KafkaIdentityAction;
import org.maxkey.identity.kafka.KafkaIdentityTopic;
import org.maxkey.identity.kafka.KafkaProvisioningService;
import org.maxkey.persistence.mapper.OrganizationsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;

import com.google.common.collect.Lists;

@Service
public class OrganizationsService extends JpaBaseService<Organizations>{
Expand Down Expand Up @@ -71,5 +90,183 @@ public boolean delete(Organizations organization) {
}
return false;
}


public boolean importing(MultipartFile file) {
if(file ==null){
return false;
}
InputStream is = null;
Workbook wb = null;
List<Organizations> orgsList = null;
try {
is = file.getInputStream();

String xls = ".xls";
String xlsx = ".xlsx";
int columnSize = 46;
orgsList = Lists.newArrayList();
if (file.getOriginalFilename().toLowerCase().endsWith(xls)) {
wb = new HSSFWorkbook(is);
} else if (file.getOriginalFilename().toLowerCase().endsWith(xlsx)) {
wb = new XSSFWorkbook(is);
} else {
throw new RuntimeException("maxKey用户导入没有Excel类型");
}

int sheetSize = wb.getNumberOfSheets();
//遍历sheet页
for (int i = 0; i < sheetSize; i++) {
Sheet sheet = wb.getSheetAt(i);

int rowSize = sheet.getLastRowNum() + 1;
//遍历行
for (int j = 1; j < rowSize; j++) {
Row row = sheet.getRow(j);
//略过空行和前3行
if (row == null || j <3 ) {
continue;
} else {
//其他行是数据行
Organizations organization =new Organizations();

for (int k = 0; k < columnSize; k++) {
if (k == 0) {
// 上级编码
Cell cell = row.getCell(k);
organization.setParentId(getValue(cell));
} else if (k == 1) {
// 上级名称
Cell cell = row.getCell(k);
organization.setParentName(getValue(cell));
} else if (k == 2) {
// 机构编码
Cell cell = row.getCell(k);
organization.setId(getValue(cell));
} else if (k == 3) {
// 机构名称
Cell cell = row.getCell(k);
organization.setName(getValue(cell));
} else if (k == 4) {
// 机构全称
Cell cell = row.getCell(k);
organization.setFullName(getValue(cell));
} else if (k == 5) {
// 编码路径
Cell cell = row.getCell(k);
organization.setCodePath(getValue(cell));
} else if (k == 6) {
// 名称路径
Cell cell = row.getCell(k);
organization.setNamePath(getValue(cell));
} else if (k == 7) {
// 机构类型
Cell cell = row.getCell(k);
organization.setType(getValue(cell));
} else if (k == 8) {
// 所属分支机构
Cell cell = row.getCell(k);
organization.setDivision(getValue(cell));
} else if (k == 9) {
// 级别
Cell cell = row.getCell(k);
String level=getValue(cell);
organization.setLevel(level.equals("") ? "1" : level);
} else if (k == 10) {
// 排序
Cell cell = row.getCell(k);
String sortIndex=getValue(cell);
organization.setSortIndex(sortIndex.equals("") ? "1" : sortIndex);
} else if (k == 11) {
// 联系人
Cell cell = row.getCell(k);
organization.setContact(getValue(cell));
} else if (k == 12) {
// 联系电话
Cell cell = row.getCell(k);
organization.setPhone(getValue(cell));
}else if (k == 13) {
// 邮箱
Cell cell = row.getCell(k);
organization.setEmail(getValue(cell));
}else if (k == 14) {
// 传真
Cell cell = row.getCell(k);
organization.setFax(getValue(cell));
}else if (k == 24) {
// 工作-国家
Cell cell = row.getCell(k);
organization.setCountry(getValue(cell));
}else if (k == 25) {
// 工作-省
Cell cell = row.getCell(k);
organization.setRegion(getValue(cell));
}else if (k == 26) {
// 工作-城市
Cell cell = row.getCell(k);
organization.setLocality(getValue(cell));
}else if (k == 27) {
// 工作-地址
Cell cell = row.getCell(k);
organization.setLocality(getValue(cell));
}else if (k == 28) {
// 邮编
Cell cell = row.getCell(k);
organization.setPostalCode(getValue(cell));
}else if (k == 29) {
// 详细描述
Cell cell = row.getCell(k);
organization.setDescription(getValue(cell));
}
}
organization.setStatus("1");
orgsList.add(organization);
}

}
}
// 数据去重
if(CollectionUtils.isEmpty(orgsList)){
orgsList = orgsList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getId()))), ArrayList::new));
}

} catch (IOException e) {
e.printStackTrace();
}finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(wb != null) {
try {
wb.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

return batchInsert(orgsList);
}

/**
* 根据数据格式返回数据
*
* @param cell
* @return
*/
public static String getValue(Cell cell) {
if (cell == null) {
return "";
} else if (cell.getCellType() == CellType.BOOLEAN) {
return String.valueOf(cell.getBooleanCellValue());
} else if (cell.getCellType() == CellType.NUMERIC) {
cell.setBlank();
return String.valueOf(cell.getStringCellValue().trim());
} else {
return String.valueOf(cell.getStringCellValue().trim());
}
}
}
Loading

0 comments on commit a44022b

Please sign in to comment.