diff --git a/renren-admin/pom.xml b/renren-admin/pom.xml
index f70b333f..eb473c04 100644
--- a/renren-admin/pom.xml
+++ b/renren-admin/pom.xml
@@ -210,6 +210,11 @@
${project.basedir}/lib/yawei-pso-2.0.2.jar
${yawei-pso.version}
+
+ com.belerweb
+ pinyin4j
+ 2.5.1
+
diff --git a/renren-admin/src/main/java/io/renren/modules/category/controller/CategoryController.java b/renren-admin/src/main/java/io/renren/modules/category/controller/CategoryController.java
index 0b10fa9f..3470f53a 100644
--- a/renren-admin/src/main/java/io/renren/modules/category/controller/CategoryController.java
+++ b/renren-admin/src/main/java/io/renren/modules/category/controller/CategoryController.java
@@ -12,6 +12,7 @@ import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.category.dto.CategoryDTO;
import io.renren.modules.category.entity.Category;
import io.renren.modules.category.service.CategoryService;
+import io.renren.modules.category.util.CommonUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -66,7 +67,7 @@ public class CategoryController {
categoryDTO.setDelFlag(0);
//若为一级分类,增加文件夹
if (ObjectUtils.isEmpty(categoryDTO.getPid())) {
- File file = new File(devModelFilePath + File.pathSeparator + categoryDTO.getName());
+ File file = new File(devModelFilePath + File.pathSeparator + CommonUtils.getPinYinHeadChar(categoryDTO.getName()));
//文件路径不存在,创建各种能力的子文件夹
if (! file.exists()) {
try {
diff --git a/renren-admin/src/main/java/io/renren/modules/category/util/CommonUtils.java b/renren-admin/src/main/java/io/renren/modules/category/util/CommonUtils.java
new file mode 100644
index 00000000..7da9c337
--- /dev/null
+++ b/renren-admin/src/main/java/io/renren/modules/category/util/CommonUtils.java
@@ -0,0 +1,27 @@
+package io.renren.modules.category.util;
+
+import net.sourceforge.pinyin4j.PinyinHelper;
+
+public class CommonUtils {
+
+ /**
+ * 得到中文首字母
+ * @param value
+ * @return
+ */
+ public static String getPinYinHeadChar(Object value) {
+ String str = String.valueOf(value);
+ String convert = "";
+ for (int j = 0; j < str.length(); j++) {
+ char word = str.charAt(j);
+ String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
+ if (pinyinArray != null) {
+ convert += pinyinArray[0].charAt(0);
+ } else {
+// convert += word;
+ break;
+ }
+ }
+ return convert;
+ }
+}
diff --git a/renren-admin/src/main/java/io/renren/modules/developmentGuide/service/impl/DevelopmentGuideServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/developmentGuide/service/impl/DevelopmentGuideServiceImpl.java
index 70b96fb3..0c127f5b 100644
--- a/renren-admin/src/main/java/io/renren/modules/developmentGuide/service/impl/DevelopmentGuideServiceImpl.java
+++ b/renren-admin/src/main/java/io/renren/modules/developmentGuide/service/impl/DevelopmentGuideServiceImpl.java
@@ -65,8 +65,8 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService {
String type = request.getParameter("type").toString();
String fileName = request.getParameter("fileName").toString();
logger.info("读取文件类型及文件名:" + type + ";" + fileName);
- File folder = new File(devModelFilePath + File.pathSeparator + type + File.separator + fileName);
- File path = new File(devModelFilePath + File.pathSeparator + type + File.separator);
+ File folder = new File(devModelFilePath + File.separator + type + File.separator + fileName);
+ File path = new File(devModelFilePath + File.separator + type + File.separator);
//文件保存过删除后重新保存
if (folder.exists()) {
if (folder.isFile()) {
@@ -82,7 +82,8 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService {
logger.info("----------------------------------文件上传成功--------------------------------------");
} catch (IOException e) {
logger.info("----------------------------------文件上传失败--------------------------------------");
- e.printStackTrace();
+ logger.info("异常描述" + e.getMessage());
+ throw e;
}
}
diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java
index 08bfd4c3..43cf61a7 100644
--- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java
+++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java
@@ -129,7 +129,7 @@ public class ResourceServiceImpl extends CrudServiceImpl wrapper = new QueryWrapper<>();
wrapper.eq("data_resource_id", resourceEntity.getId())
- .eq("del_flag", 0);
+ .eq("del_f lag", 0);
List attrEntities = attrDao.selectList(wrapper);
resourceDTO.setInfoList(attrEntities);
return resourceDTO;