Merge branches 'dev' and 'test' of http://git.estsh.com/i3-IMPP/i3plus-core into dev

yun-zuoyi
wei.peng 7 years ago
commit 0a1c9649b3

@ -5,7 +5,7 @@
<parent>
<artifactId>i3plus-core</artifactId>
<groupId>i3plus.core</groupId>
<version>1.0-DEV-SNAPSHOT</version>
<version>1.0-TEST-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -5,7 +5,7 @@
<parent>
<artifactId>i3plus-core</artifactId>
<groupId>i3plus.core</groupId>
<version>1.0-DEV-SNAPSHOT</version>
<version>1.0-TEST-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -13,11 +13,6 @@ impp.cluster.regist.center=http://reg.estsh.com/eureka/
#多注册中心
#impp.cluster.regist.center=http://192.168.1.20:8000/eureka/,http://192.168.1.20:8001/eureka/
################ 功能配置2 ################
#是否允许前端跨域提交impp.web.cross.hosts
impp.web.cross = true
################ 授权过滤配置 ################
#用户登陆路径
filter.shiro.user.loginuri = /login
#系统管理员登陆路径

@ -2,7 +2,7 @@
spring.application.name=${project.name}
#使用配置
spring.profiles.active=dev
spring.profiles.active=test
######### 自定义参数 #########
#项目描述信息swagger中显式中文使用uncode转码

@ -141,6 +141,7 @@ public class TestExcelPermission extends TestBase {
obj.setUserInfoId(Long.parseLong(row.getCell(5).getStringCellValue()));
obj.setUserName(row.getCell(6).getStringCellValue());
obj.setIsValid(1);
obj.setUserStatus(1);
obj.setUserType(1);
obj.setUserLoginNum(0);

@ -1,207 +1,207 @@
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
//
//import cn.estsh.i3plus.pojo.platform.bean.*;
//import cn.estsh.i3plus.pojo.platform.repository.SysConfigRepository;
//import cn.estsh.i3plus.pojo.platform.repository.SysDictionaryRepository;
//import cn.estsh.i3plus.pojo.platform.repository.SysLocaleLanguageRepository;
//import cn.estsh.i3plus.pojo.platform.repository.SysLocaleResourceRepository;
//import org.apache.poi.ss.usermodel.Row;
//import org.apache.poi.xssf.usermodel.XSSFSheet;
//import org.apache.poi.xssf.usermodel.XSSFWorkbook;
//import org.junit.Test;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import java.io.InputStream;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @Description :
// * @Reference :
// * @Author : yunhao
// * @CreateDate : 2018-11-22 11:01
// * @Modify:
// **/
//public class TestExcelSysConfig extends TestBase {
//
// public static final Logger LOGGER = LoggerFactory.getLogger(TestExcelPermission.class);
//
// // 文件路径
// public static final String PATH_NAME = "init/sys-config.xlsx";
// // 权限Sheet 名称
// public static final String SHEET_SYS_CONFIG = "sys-config";
// public static final String SHEET_DICTIONARY = "dictionary";
// public static final String SHEET_LANGUAGE = "language";
// public static final String SHEET_RESOURCE = "resource";
//
// @Autowired
// private SysConfigRepository sysConfigRDao;
// @Autowired
// private SysDictionaryRepository sysDictionaryRDao;
// @Autowired
// private SysLocaleLanguageRepository sysLocaleLanguageRDao;
// @Autowired
// private SysLocaleResourceRepository sysLocaleResourceRDao;
//
// @Test
// public void testInit() throws Exception {
// XSSFWorkbook workbook = getWorkbook(PATH_NAME);
// if(workbook != null){
// XSSFSheet sheetSysConfig = workbook.getSheet(SHEET_SYS_CONFIG);
// XSSFSheet sheetDictionary = workbook.getSheet(SHEET_DICTIONARY);
// XSSFSheet sheetLanguage = workbook.getSheet(SHEET_LANGUAGE);
// XSSFSheet sheetResource = workbook.getSheet(SHEET_RESOURCE);
//
// List<SysConfig> sysConfigList = getSysConfig(sheetSysConfig);
// List<SysDictionary> sysDictionaryList = getSysDictionary(sheetDictionary);
// List<SysLocaleLanguage> sysLocaleLanguageList = getSysLocaleLanguage(sheetLanguage);
// List<SysLocaleResource> sysLocaleResourceList= getSysLocaleResource(sheetResource);
//
// LOGGER.info("System Init SysConfig Size:{}",sysConfigList.size());
// LOGGER.info("System Init SysDictionary Size:{}",sysDictionaryList.size());
// LOGGER.info("System Init SysLocaleLanguage Size:{}",sysLocaleLanguageList.size());
// LOGGER.info("System Init SysLocaleResource Size:{}",sysLocaleResourceList.size());
//
// sysConfigRDao.saveAll(sysConfigList);
// sysDictionaryRDao.saveAll(sysDictionaryList);
// sysLocaleLanguageRDao.saveAll(sysLocaleLanguageList);
// sysLocaleResourceRDao.saveAll(sysLocaleResourceList);
// }
// }
//
// public List<SysConfig> getSysConfig(XSSFSheet sheet){
// List<SysConfig> result = new ArrayList<>();
// if(sheet != null){
// if(sheet.getLastRowNum() >= 1){
// SysConfig obj = null;
// for (int i = 1; i <= sheet.getLastRowNum(); i++) {
// try {
// Row row = sheet.getRow(i);//获取索引为i的行以0开始
// if(row.getCell(0).toString().trim().length() > 0){
// obj = new SysConfig();
// obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
// obj.setName(row.getCell(1).getStringCellValue());
// obj.setConfigType(Integer.valueOf(row.getCell(2).getStringCellValue()));
// obj.setConfigCode(row.getCell(3).getStringCellValue());
// obj.setConfigValue(row.getCell(4).getStringCellValue());
// obj.setConfigDescription(row.getCell(5).getStringCellValue());
// obj.setIsValid(1);
//
// result.add(obj);
// }
// }catch (Exception e){
// LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
// }
// }
// }
// }
// return result;
// }
//
// public List<SysDictionary> getSysDictionary(XSSFSheet sheet){
// List<SysDictionary> result = new ArrayList<>();
// if(sheet != null){
// if(sheet.getLastRowNum() >= 1){
// SysDictionary obj = null;
// for (int i = 1; i <= sheet.getLastRowNum(); i++) {
// try {
// Row row = sheet.getRow(i);//获取索引为i的行以0开始
// if(row.getCell(0).toString().trim().length() > 0){
// obj = new SysDictionary();
// obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
// obj.setName(row.getCell(1).getStringCellValue());
// obj.setDictionaryCode(row.getCell(2).getStringCellValue());
// obj.setParentId(Long.valueOf(row.getCell(3).getStringCellValue()));
// obj.setParentNameRdd(row.getCell(4).getStringCellValue());
// obj.setParentCodeRdd(row.getCell(5).getStringCellValue());
// obj.setDictionaryValue(row.getCell(6).getStringCellValue());
// obj.setDictionarySort(Integer.valueOf(row.getCell(7).getStringCellValue()));
// obj.setDictionaryDescription(row.getCell(8).getStringCellValue());
// obj.setIsValid(1);
//
// result.add(obj);
// }
// }catch (Exception e){
// LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
// }
// }
// }
// }
// return result;
// }
//
// public List<SysLocaleLanguage> getSysLocaleLanguage(XSSFSheet sheet){
// List<SysLocaleLanguage> result = new ArrayList<>();
// if(sheet != null){
// if(sheet.getLastRowNum() >= 1){
// SysLocaleLanguage obj = null;
// for (int i = 1; i <= sheet.getLastRowNum(); i++) {
// try {
// Row row = sheet.getRow(i);//获取索引为i的行以0开始
// if(row.getCell(0).toString().trim().length() > 0){
// obj = new SysLocaleLanguage();
// obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
// obj.setLanguageName(row.getCell(1).getStringCellValue());
// obj.setLanguageCode(row.getCell(2).getStringCellValue());
// obj.setLanguageSort(Integer.valueOf(row.getCell(3).getStringCellValue()));
// obj.setIsDefault(Integer.valueOf(row.getCell(4).getStringCellValue()));
// obj.setLanguageStatus(Integer.valueOf(row.getCell(5).getStringCellValue()));
// obj.setIsValid(1);
//
// result.add(obj);
// }
// }catch (Exception e){
// LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
// }
// }
// }
// }
// return result;
// }
//
// public List<SysLocaleResource> getSysLocaleResource(XSSFSheet sheet){
// List<SysLocaleResource> result = new ArrayList<>();
// if(sheet != null){
// if(sheet.getLastRowNum() >= 1){
// SysLocaleResource obj = null;
// for (int i = 1; i <= sheet.getLastRowNum(); i++) {
// try {
// Row row = sheet.getRow(i);//获取索引为i的行以0开始
// if(row.getCell(0).toString().trim().length() > 0){
// obj = new SysLocaleResource();
// obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
// obj.setResourceType(Integer.valueOf(row.getCell(1).getStringCellValue()));
// obj.setLanguageCode(row.getCell(2).getStringCellValue());
// obj.setLanguageNameRdd(row.getCell(3).getStringCellValue());
// obj.setResourceKey(row.getCell(4).getStringCellValue());
// obj.setResourceValue(row.getCell(5).getStringCellValue());
// obj.setIsSystem(Integer.valueOf(row.getCell(6).getStringCellValue()));
// obj.setIsValid(1);
//
// result.add(obj);
// }
// }catch (Exception e){
// LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
// }
// }
// }
// }
// return result;
// }
//
//
// public XSSFWorkbook getWorkbook(String pathName){
// try {
// InputStream in = TestExcelPermission.class.getClassLoader().getResourceAsStream(pathName);
// XSSFWorkbook workbook = new XSSFWorkbook(in);
// return workbook;
// }catch (Exception e){
// LOGGER.error(" System Init Sys Data Excel Error file path {} error message :{}",pathName,e.getMessage());
// e.getMessage();
// return null;
// }
// }
//
//}
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.i3plus.pojo.platform.repository.SysConfigRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysDictionaryRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysLocaleLanguageRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysLocaleResourceRepository;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @CreateDate : 2018-11-22 11:01
* @Modify:
**/
public class TestExcelSysConfig extends TestBase {
public static final Logger LOGGER = LoggerFactory.getLogger(TestExcelPermission.class);
// 文件路径
public static final String PATH_NAME = "init/sys-config.xlsx";
// 权限Sheet 名称
public static final String SHEET_SYS_CONFIG = "sys-config";
public static final String SHEET_DICTIONARY = "dictionary";
public static final String SHEET_LANGUAGE = "language";
public static final String SHEET_RESOURCE = "resource";
@Autowired
private SysConfigRepository sysConfigRDao;
@Autowired
private SysDictionaryRepository sysDictionaryRDao;
@Autowired
private SysLocaleLanguageRepository sysLocaleLanguageRDao;
@Autowired
private SysLocaleResourceRepository sysLocaleResourceRDao;
@Test
public void testInit() throws Exception {
XSSFWorkbook workbook = getWorkbook(PATH_NAME);
if(workbook != null){
XSSFSheet sheetSysConfig = workbook.getSheet(SHEET_SYS_CONFIG);
XSSFSheet sheetDictionary = workbook.getSheet(SHEET_DICTIONARY);
XSSFSheet sheetLanguage = workbook.getSheet(SHEET_LANGUAGE);
XSSFSheet sheetResource = workbook.getSheet(SHEET_RESOURCE);
List<SysConfig> sysConfigList = getSysConfig(sheetSysConfig);
List<SysDictionary> sysDictionaryList = getSysDictionary(sheetDictionary);
List<SysLocaleLanguage> sysLocaleLanguageList = getSysLocaleLanguage(sheetLanguage);
List<SysLocaleResource> sysLocaleResourceList= getSysLocaleResource(sheetResource);
LOGGER.info("System Init SysConfig Size:{}",sysConfigList.size());
LOGGER.info("System Init SysDictionary Size:{}",sysDictionaryList.size());
LOGGER.info("System Init SysLocaleLanguage Size:{}",sysLocaleLanguageList.size());
LOGGER.info("System Init SysLocaleResource Size:{}",sysLocaleResourceList.size());
sysConfigRDao.saveAll(sysConfigList);
sysDictionaryRDao.saveAll(sysDictionaryList);
sysLocaleLanguageRDao.saveAll(sysLocaleLanguageList);
sysLocaleResourceRDao.saveAll(sysLocaleResourceList);
}
}
public List<SysConfig> getSysConfig(XSSFSheet sheet){
List<SysConfig> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysConfig obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysConfig();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setName(row.getCell(1).getStringCellValue());
obj.setConfigType(Integer.valueOf(row.getCell(2).getStringCellValue()));
obj.setConfigCode(row.getCell(3).getStringCellValue());
obj.setConfigValue(row.getCell(4).getStringCellValue());
obj.setConfigDescription(row.getCell(5).getStringCellValue());
obj.setIsValid(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public List<SysDictionary> getSysDictionary(XSSFSheet sheet){
List<SysDictionary> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysDictionary obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysDictionary();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setName(row.getCell(1).getStringCellValue());
obj.setDictionaryCode(row.getCell(2).getStringCellValue());
obj.setParentId(Long.valueOf(row.getCell(3).getStringCellValue()));
obj.setParentNameRdd(row.getCell(4).getStringCellValue());
obj.setParentCodeRdd(row.getCell(5).getStringCellValue());
obj.setDictionaryValue(row.getCell(6).getStringCellValue());
obj.setDictionarySort(Integer.valueOf(row.getCell(7).getStringCellValue()));
obj.setDictionaryDescription(row.getCell(8).getStringCellValue());
obj.setIsValid(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public List<SysLocaleLanguage> getSysLocaleLanguage(XSSFSheet sheet){
List<SysLocaleLanguage> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysLocaleLanguage obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysLocaleLanguage();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setLanguageName(row.getCell(1).getStringCellValue());
obj.setLanguageCode(row.getCell(2).getStringCellValue());
obj.setLanguageSort(Integer.valueOf(row.getCell(3).getStringCellValue()));
obj.setIsDefault(Integer.valueOf(row.getCell(4).getStringCellValue()));
obj.setLanguageStatus(Integer.valueOf(row.getCell(5).getStringCellValue()));
obj.setIsValid(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public List<SysLocaleResource> getSysLocaleResource(XSSFSheet sheet){
List<SysLocaleResource> result = new ArrayList<>();
if(sheet != null){
if(sheet.getLastRowNum() >= 1){
SysLocaleResource obj = null;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
try {
Row row = sheet.getRow(i);//获取索引为i的行以0开始
if(row.getCell(0).toString().trim().length() > 0){
obj = new SysLocaleResource();
obj.setId(Long.parseLong(row.getCell(0).getStringCellValue()));
obj.setResourceType(Integer.valueOf(row.getCell(1).getStringCellValue()));
obj.setLanguageCode(row.getCell(2).getStringCellValue());
obj.setLanguageNameRdd(row.getCell(3).getStringCellValue());
obj.setResourceKey(row.getCell(4).getStringCellValue());
obj.setResourceValue(row.getCell(5).getStringCellValue());
obj.setIsSystem(Integer.valueOf(row.getCell(6).getStringCellValue()));
obj.setIsValid(1);
result.add(obj);
}
}catch (Exception e){
LOGGER.error("Excel Sheet Name :{} Index:{} DataType Error", sheet.getSheetName(), i);
}
}
}
}
return result;
}
public XSSFWorkbook getWorkbook(String pathName){
try {
InputStream in = TestExcelPermission.class.getClassLoader().getResourceAsStream(pathName);
XSSFWorkbook workbook = new XSSFWorkbook(in);
return workbook;
}catch (Exception e){
LOGGER.error(" System Init Sys Data Excel Error file path {} error message :{}",pathName,e.getMessage());
e.getMessage();
return null;
}
}
}

@ -7,7 +7,7 @@
<groupId>i3plus.core</groupId>
<artifactId>i3plus-core</artifactId>
<packaging>pom</packaging>
<version>1.0-DEV-SNAPSHOT</version>
<version>1.0-TEST-SNAPSHOT</version>
<modules>
<module>modules/i3plus-core-api</module>
<module>modules/i3plus-core-apiservice</module>

Loading…
Cancel
Save