From 75e456054bd77717e6906d42b876473c7f6554e1 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Sun, 8 Dec 2019 14:42:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lq/api/service/impl/SysFileServiceImpl.java | 3 +-- src/main/java/com/lq/api/web/SysFileController.java | 6 +++--- src/main/java/com/lq/api/web/UmUeditorFileController.java | 7 +++++-- .../java/com/lq/cms/service/impl/AdminBaseServiceImpl.java | 2 +- .../com/lq/cms/service/impl/SysResourceServiceImpl.java | 4 +--- .../com/lq/cms/service/impl/SysUserRoleServiceImpl.java | 1 - .../com/lq/cms/service/impl/WechatRuleServiceImpl.java | 3 +-- .../com/lq/cms/service/impl/WechatUserServiceImpl.java | 3 +-- .../{AdminBaseController.java => BaseAdminController.java} | 4 ++-- src/main/java/com/lq/cms/web/sys/MenuController.java | 1 + src/main/java/com/lq/cms/web/sys/UserController.java | 7 ++----- .../com/lq/cms/web/wechat/WechatMessageController.java | 7 ++----- src/main/java/com/lq/code/util/sql/MysqlBuilder.java | 2 +- .../code/util/sql/factory/impl/DefaultDbBuilerFactory.java | 1 + src/main/profile/dev/redis.properties | 2 +- 15 files changed, 23 insertions(+), 30 deletions(-) rename src/main/java/com/lq/cms/web/{AdminBaseController.java => BaseAdminController.java} (96%) diff --git a/src/main/java/com/lq/api/service/impl/SysFileServiceImpl.java b/src/main/java/com/lq/api/service/impl/SysFileServiceImpl.java index 9aadea4..db050c8 100755 --- a/src/main/java/com/lq/api/service/impl/SysFileServiceImpl.java +++ b/src/main/java/com/lq/api/service/impl/SysFileServiceImpl.java @@ -2,14 +2,13 @@ package com.lq.api.service.impl; import com.lq.api.service.SysFileService; import com.lq.code.dao.BaseDao; -import com.lq.code.service.impl.BaseServiceImpl; import com.lq.dao.SysFileDao; import com.lq.entity.SysFile; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service -public class SysFileServiceImpl extends BaseServiceImpl implements SysFileService { +public class SysFileServiceImpl implements SysFileService { @Autowired private SysFileDao sysFileDao; diff --git a/src/main/java/com/lq/api/web/SysFileController.java b/src/main/java/com/lq/api/web/SysFileController.java index aa3a19c..9a4fddc 100755 --- a/src/main/java/com/lq/api/web/SysFileController.java +++ b/src/main/java/com/lq/api/web/SysFileController.java @@ -29,7 +29,7 @@ public class SysFileController { @Value("${file.upload}") - private String FILE_LOAD_PATH; + private String fileLoadPath; @Autowired private SysFileService sysFileService; @@ -41,14 +41,14 @@ public class SysFileController { ajaxResult.setMsg("上传成功"); Date nowTime = new Date(); SimpleDateFormat sdf =new SimpleDateFormat("yyyyMMdd"); - File fileDir = new File(FILE_LOAD_PATH+sdf.format(nowTime)); + File fileDir = new File(fileLoadPath+sdf.format(nowTime)); if (!fileDir.exists()){ fileDir.mkdirs(); } List sysFileList = new ArrayList<>(); for (MultipartFile multipartFile:files){ String originalFileName = multipartFile.getOriginalFilename(); - Path path = FileSystems.getDefault().getPath(FILE_LOAD_PATH+sdf.format(nowTime),originalFileName); + Path path = FileSystems.getDefault().getPath(fileLoadPath+sdf.format(nowTime),originalFileName); //上传文件 multipartFile.transferTo(path); //保存文件信息 diff --git a/src/main/java/com/lq/api/web/UmUeditorFileController.java b/src/main/java/com/lq/api/web/UmUeditorFileController.java index f483fcc..76bff79 100755 --- a/src/main/java/com/lq/api/web/UmUeditorFileController.java +++ b/src/main/java/com/lq/api/web/UmUeditorFileController.java @@ -25,8 +25,11 @@ import java.util.concurrent.ThreadLocalRandom; @RequestMapping("/ueditor") public class UmUeditorFileController { + /** + * 文件上传路径 + */ @Value("${file.upload}") - private String FILE_LOAD_PATH; + private String fileLoadPath; @RequestMapping(value = "/fileupload",method = RequestMethod.POST) @@ -36,7 +39,7 @@ public class UmUeditorFileController { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); UeditorVo vo = null; if (files!=null&&files.length>0){ - File fileDir = new File(FILE_LOAD_PATH+"images/"+sdf.format(nowTime)); + File fileDir = new File(fileLoadPath+"images/"+sdf.format(nowTime)); if (!fileDir.exists()){ fileDir.mkdirs(); } diff --git a/src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java b/src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java index 80b4512..e94df97 100755 --- a/src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java @@ -44,7 +44,7 @@ public abstract class AdminBaseServiceImpl implements @Override public T update(AdminBaseVo vo) { - T t = (T) getBaseDao().findOne(vo.getId()); + T t = getBaseDao().findOne(vo.getId()); BeanUtil.copyNotNull(t,vo); getBaseDao().update(t); return t; diff --git a/src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java index 4fc6597..9989588 100755 --- a/src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java @@ -8,7 +8,6 @@ import com.lq.cms.mode.MenusItem; import com.lq.cms.service.SysResourceService; import com.lq.cms.vo.SysResourceVo; import com.lq.code.dao.BaseDao; -import com.lq.code.service.impl.BaseServiceImpl; import com.lq.code.util.Constant; import com.lq.dao.SysResourceDao; import com.lq.entity.SysResource; @@ -16,13 +15,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; -import java.util.stream.Stream; /** * Created by qi_liang on 2018/6/21. */ @Service -public class SysResourceServiceImpl extends BaseServiceImpl implements SysResourceService { +public class SysResourceServiceImpl implements SysResourceService { @Autowired private SysResourceDao sysResourceDao; diff --git a/src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java index 5a3c0f5..56caf71 100755 --- a/src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java @@ -3,7 +3,6 @@ package com.lq.cms.service.impl; import com.lq.cms.emun.StatusTypeEnum; import com.lq.cms.service.SysUserRoleService; import com.lq.code.dao.BaseDao; -import com.lq.code.service.impl.BaseServiceImpl; import com.lq.dao.SysUserRoleDao; import com.lq.entity.SysUserRole; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java b/src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java index 3ca01ba..6f595c5 100644 --- a/src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java @@ -6,7 +6,6 @@ import com.lq.cms.emun.WechatMessageTypeEnum; import com.lq.cms.service.WechatRuleService; import com.lq.cms.vo.WechatRuleVo; import com.lq.code.dao.BaseDao; -import com.lq.code.service.impl.BaseServiceImpl; import com.lq.code.util.BeanUtil; import com.lq.dao.WechatKeywordDao; import com.lq.dao.WechatMessageDao; @@ -35,7 +34,7 @@ import java.util.concurrent.atomic.AtomicReference; * @Date: Create in 5:55 AM 2019/5/11 */ @Service -public class WechatRuleServiceImpl extends BaseServiceImpl implements WechatRuleService { +public class WechatRuleServiceImpl implements WechatRuleService { @Autowired private WechatRuleDao wechatRuleDao; diff --git a/src/main/java/com/lq/cms/service/impl/WechatUserServiceImpl.java b/src/main/java/com/lq/cms/service/impl/WechatUserServiceImpl.java index 7483579..b0fdcb8 100755 --- a/src/main/java/com/lq/cms/service/impl/WechatUserServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/WechatUserServiceImpl.java @@ -2,7 +2,6 @@ package com.lq.cms.service.impl; import com.lq.cms.service.WechatUserService; import com.lq.code.dao.BaseDao; -import com.lq.code.service.impl.BaseServiceImpl; import com.lq.dao.WechatUserDao; import com.lq.entity.WechatInfo; import com.lq.entity.WechatUser; @@ -16,7 +15,7 @@ import org.springframework.stereotype.Service; * @Date: Create in 9:02 PM 2019/3/16 */ @Service -public class WechatUserServiceImpl extends BaseServiceImpl implements WechatUserService { +public class WechatUserServiceImpl implements WechatUserService { @Autowired private WechatUserDao wechatUserDao; diff --git a/src/main/java/com/lq/cms/web/AdminBaseController.java b/src/main/java/com/lq/cms/web/BaseAdminController.java similarity index 96% rename from src/main/java/com/lq/cms/web/AdminBaseController.java rename to src/main/java/com/lq/cms/web/BaseAdminController.java index 3d1b673..0b4dc52 100755 --- a/src/main/java/com/lq/cms/web/AdminBaseController.java +++ b/src/main/java/com/lq/cms/web/BaseAdminController.java @@ -19,9 +19,9 @@ import org.springframework.web.bind.annotation.ResponseBody; * 管理后台 父类 * 强封装,缺少扩展,不建议采用 */ -public abstract class AdminBaseController { +public abstract class BaseAdminController { - public static final Logger LOGGER = LoggerFactory.getLogger(AdminBaseController.class); + public static final Logger LOGGER = LoggerFactory.getLogger(BaseAdminController.class); /** diff --git a/src/main/java/com/lq/cms/web/sys/MenuController.java b/src/main/java/com/lq/cms/web/sys/MenuController.java index 866a988..21e6344 100755 --- a/src/main/java/com/lq/cms/web/sys/MenuController.java +++ b/src/main/java/com/lq/cms/web/sys/MenuController.java @@ -25,6 +25,7 @@ import java.util.List; /** 菜单控制类 * Created by qi_liang on 2018/1/25. + * @author qi */ @Controller @RequestMapping("/cms/menu") diff --git a/src/main/java/com/lq/cms/web/sys/UserController.java b/src/main/java/com/lq/cms/web/sys/UserController.java index e62139d..5e8cde3 100755 --- a/src/main/java/com/lq/cms/web/sys/UserController.java +++ b/src/main/java/com/lq/cms/web/sys/UserController.java @@ -8,14 +8,11 @@ import com.lq.cms.service.SysUserService; import com.lq.cms.vo.SysUserRoleVo; import com.lq.cms.vo.SysUserVo; import com.lq.code.entity.AjaxResult; -import com.lq.code.interceptor.shiro.ShiroRealm; import com.lq.code.util.*; import com.lq.entity.SysUser; import org.apache.log4j.Logger; import org.apache.shiro.SecurityUtils; -import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.apache.shiro.cache.Cache; import org.apache.shiro.mgt.RealmSecurityManager; import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.subject.SimplePrincipalCollection; @@ -58,7 +55,7 @@ public class UserController { private SysUserRoleService sysUserRoleService; @Value("${file.upload}") - private String FILE_LOAD_PATH; + private String fileLoadPath; @RequestMapping("/index") public ModelAndView index(ModelAndView modelAndView){ @@ -148,7 +145,7 @@ public class UserController { UUID uuid = UUID.randomUUID(); String fileType = FileUtil.fileFormat(multipartFile.getOriginalFilename()); newFileName = "user/"+uuid.toString()+"."+fileType; - File newFile = new File(FILE_LOAD_PATH +newFileName); + File newFile = new File(fileLoadPath +newFileName); if (!newFile.exists()){ newFile.mkdirs(); } diff --git a/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java b/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java index 3f96ae1..5d8fb3f 100755 --- a/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java +++ b/src/main/java/com/lq/cms/web/wechat/WechatMessageController.java @@ -2,16 +2,13 @@ package com.lq.cms.web.wechat; import com.lq.cms.emun.WechatMessageTypeEnum; import com.lq.cms.mode.AdminDataGridParam; -import com.lq.cms.service.AdminBaseService; import com.lq.cms.service.WechatMessageService; import com.lq.cms.vo.WechatMessageBo; import com.lq.cms.vo.WechatMessageVo; -import com.lq.cms.web.AdminBaseController; import com.lq.code.entity.AjaxResult; import com.lq.code.util.Constant; import com.lq.code.util.FileUtil; import com.lq.code.util.StringUtil; -import com.lq.entity.SysUser; import com.lq.entity.WechatMessage; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -43,7 +40,7 @@ public class WechatMessageController { private WechatMessageService wechatMessageService; @Value("${file.upload}") - private String FILE_LOAD_PATH; + private String fileLoadPath; @RequestMapping("/index") @@ -131,7 +128,7 @@ public class WechatMessageController { UUID uuid = UUID.randomUUID(); String fileType = FileUtil.fileFormat(multipartFile.getOriginalFilename()); newFileName = "wechat/"+uuid.toString()+"."+fileType; - File newFile = new File(FILE_LOAD_PATH +newFileName); + File newFile = new File(fileLoadPath +newFileName); if (!newFile.exists()){ newFile.mkdirs(); diff --git a/src/main/java/com/lq/code/util/sql/MysqlBuilder.java b/src/main/java/com/lq/code/util/sql/MysqlBuilder.java index 04df923..a97b771 100755 --- a/src/main/java/com/lq/code/util/sql/MysqlBuilder.java +++ b/src/main/java/com/lq/code/util/sql/MysqlBuilder.java @@ -42,7 +42,7 @@ public class MysqlBuilder extends AbstractDbBuiler { if(tableList!=null&&tableList.size()>0) { Iterator tableIterator = tableList.iterator(); while (tableIterator.hasNext()) { - Table table = (Table) tableIterator.next(); + Table table = tableIterator.next(); if (map.containsKey(table.getTableName())) { Class clazz = map.get(table.getTableName()); Map clazzMap = new HashMap<>(); diff --git a/src/main/java/com/lq/code/util/sql/factory/impl/DefaultDbBuilerFactory.java b/src/main/java/com/lq/code/util/sql/factory/impl/DefaultDbBuilerFactory.java index 5f62bb0..e649cf4 100644 --- a/src/main/java/com/lq/code/util/sql/factory/impl/DefaultDbBuilerFactory.java +++ b/src/main/java/com/lq/code/util/sql/factory/impl/DefaultDbBuilerFactory.java @@ -23,6 +23,7 @@ public class DefaultDbBuilerFactory implements DbBuilerFactory { case SqlConstant.DB_TYPE_ORACLE: abstractDbBuiler = new OracleBuiler(); break; + default: abstractDbBuiler = null; } return abstractDbBuiler; } diff --git a/src/main/profile/dev/redis.properties b/src/main/profile/dev/redis.properties index 9b38d93..498bd32 100644 --- a/src/main/profile/dev/redis.properties +++ b/src/main/profile/dev/redis.properties @@ -13,4 +13,4 @@ redis.maxWaitMillis=1500 redis.testWhileIdle=true redis.blockWhenExhausted=false redis.minIdle=5 -redis.testOnBorrow=true \ No newline at end of file +redis.testOnBorrow=true \ No newline at end of file