优化代码

master
星期八 5 years ago
parent e3a60914dd
commit 75e456054b
  1. 3
      src/main/java/com/lq/api/service/impl/SysFileServiceImpl.java
  2. 6
      src/main/java/com/lq/api/web/SysFileController.java
  3. 7
      src/main/java/com/lq/api/web/UmUeditorFileController.java
  4. 2
      src/main/java/com/lq/cms/service/impl/AdminBaseServiceImpl.java
  5. 4
      src/main/java/com/lq/cms/service/impl/SysResourceServiceImpl.java
  6. 1
      src/main/java/com/lq/cms/service/impl/SysUserRoleServiceImpl.java
  7. 3
      src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java
  8. 3
      src/main/java/com/lq/cms/service/impl/WechatUserServiceImpl.java
  9. 4
      src/main/java/com/lq/cms/web/BaseAdminController.java
  10. 1
      src/main/java/com/lq/cms/web/sys/MenuController.java
  11. 7
      src/main/java/com/lq/cms/web/sys/UserController.java
  12. 7
      src/main/java/com/lq/cms/web/wechat/WechatMessageController.java
  13. 2
      src/main/java/com/lq/code/util/sql/MysqlBuilder.java
  14. 1
      src/main/java/com/lq/code/util/sql/factory/impl/DefaultDbBuilerFactory.java
  15. 2
      src/main/profile/dev/redis.properties

@ -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<SysFile> implements SysFileService {
public class SysFileServiceImpl implements SysFileService {
@Autowired
private SysFileDao sysFileDao;

@ -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<SysFile> 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);
//保存文件信息

@ -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();
}

@ -44,7 +44,7 @@ public abstract class AdminBaseServiceImpl<T,V extends AdminBaseVo> 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;

@ -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<SysResource> implements SysResourceService {
public class SysResourceServiceImpl implements SysResourceService {
@Autowired
private SysResourceDao sysResourceDao;

@ -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;

@ -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<WechatRule> implements WechatRuleService {
public class WechatRuleServiceImpl implements WechatRuleService {
@Autowired
private WechatRuleDao wechatRuleDao;

@ -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<WechatUser> implements WechatUserService {
public class WechatUserServiceImpl implements WechatUserService {
@Autowired
private WechatUserDao wechatUserDao;

@ -19,9 +19,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
* 管理后台 父类
* 强封装缺少扩展不建议采用
*/
public abstract class AdminBaseController<T,V extends AdminBaseVo> {
public abstract class BaseAdminController<T,V extends AdminBaseVo> {
public static final Logger LOGGER = LoggerFactory.getLogger(AdminBaseController.class);
public static final Logger LOGGER = LoggerFactory.getLogger(BaseAdminController.class);
/**

@ -25,6 +25,7 @@ import java.util.List;
/** 菜单控制类
* Created by qi_liang on 2018/1/25.
* @author qi
*/
@Controller
@RequestMapping("/cms/menu")

@ -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();
}

@ -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();

@ -42,7 +42,7 @@ public class MysqlBuilder extends AbstractDbBuiler {
if(tableList!=null&&tableList.size()>0) {
Iterator<Table> 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<String, Object> clazzMap = new HashMap<>();

@ -23,6 +23,7 @@ public class DefaultDbBuilerFactory implements DbBuilerFactory {
case SqlConstant.DB_TYPE_ORACLE:
abstractDbBuiler = new OracleBuiler();
break;
default: abstractDbBuiler = null;
}
return abstractDbBuiler;
}

@ -13,4 +13,4 @@ redis.maxWaitMillis=1500
redis.testWhileIdle=true
redis.blockWhenExhausted=false
redis.minIdle=5
redis.testOnBorrow=true
redis.testOnBorrow=true
Loading…
Cancel
Save