代码提交
This commit is contained in:
@@ -18,7 +18,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CacheConfig(cacheNames = "codeDetail")
|
|
||||||
public class CodeDetailServiceImpl implements CodeDetailService {
|
public class CodeDetailServiceImpl implements CodeDetailService {
|
||||||
@Override
|
@Override
|
||||||
public JSONObject queryAll(Map form, Pageable pageable) {
|
public JSONObject queryAll(Map form, Pageable pageable) {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import java.util.Set;
|
|||||||
**/
|
**/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CacheConfig(cacheNames = "data")
|
|
||||||
public class DataServiceImpl implements DataService {
|
public class DataServiceImpl implements DataService {
|
||||||
|
|
||||||
private final RoleService roleService;
|
private final RoleService roleService;
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CacheConfig(cacheNames = "dept")
|
|
||||||
public class DeptServiceImpl implements DeptService {
|
public class DeptServiceImpl implements DeptService {
|
||||||
|
|
||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
|
|||||||
@@ -40,18 +40,17 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Zheng Jie
|
* @author Zheng Jie
|
||||||
* @date 2019-04-10
|
* @date 2019-04-10
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CacheConfig(cacheNames = "dict")
|
|
||||||
public class DictDetailServiceImpl implements DictDetailService {
|
public class DictDetailServiceImpl implements DictDetailService {
|
||||||
|
|
||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) {
|
public Map<String, Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) {
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("flag", "2");
|
map.put("flag", "2");
|
||||||
map.put("code", criteria.getCode());
|
map.put("code", criteria.getCode());
|
||||||
@@ -66,7 +65,7 @@ public class DictDetailServiceImpl implements DictDetailService {
|
|||||||
// 校验是否已经有标签
|
// 校验是否已经有标签
|
||||||
JSONObject object = wo.query("label = '" + resources.getLabel() + "' " +
|
JSONObject object = wo.query("label = '" + resources.getLabel() + "' " +
|
||||||
"AND code = '" + resources.getDictCode() + "'").uniqueResult(0);
|
"AND code = '" + resources.getDictCode() + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(object)) throw new BadRequestException("标签["+ resources.getLabel() + "]已存在");
|
if (ObjectUtil.isNotEmpty(object)) throw new BadRequestException("标签[" + resources.getLabel() + "]已存在");
|
||||||
JSONObject dictObj = wo.query("code = '" + resources.getDictCode() + "'").uniqueResult(0);
|
JSONObject dictObj = wo.query("code = '" + resources.getDictCode() + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(dictObj.getString("label"))) {
|
if (ObjectUtil.isEmpty(dictObj.getString("label"))) {
|
||||||
// 空就赋值
|
// 空就赋值
|
||||||
@@ -141,9 +140,10 @@ public class DictDetailServiceImpl implements DictDetailService {
|
|||||||
dictTab.delete(json);
|
dictTab.delete(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delCaches(DictDto dict){
|
public void delCaches(DictDto dict) {
|
||||||
redisUtils.del("dict::name:" + dict.getName());
|
redisUtils.del("dict::name:" + dict.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DictDto findById(Long dict_id) {
|
public DictDto findById(Long dict_id) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
//@CacheConfig(cacheNames = "dict")
|
|
||||||
public class DictServiceImpl implements DictService {
|
public class DictServiceImpl implements DictService {
|
||||||
|
|
||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CacheConfig(cacheNames = "menu")
|
|
||||||
public class MenuServiceImpl implements MenuService {
|
public class MenuServiceImpl implements MenuService {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
package org.nl.modules.system.service.impl;
|
package org.nl.modules.system.service.impl;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@@ -24,14 +23,8 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.CacheKey;
|
|
||||||
import org.nl.modules.common.utils.RedisUtils;
|
|
||||||
import org.nl.modules.common.utils.SecurityUtils;
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
import org.nl.modules.system.domain.Role;
|
|
||||||
import org.nl.modules.system.domain.User;
|
|
||||||
import org.nl.modules.system.service.RoleService;
|
import org.nl.modules.system.service.RoleService;
|
||||||
import org.nl.modules.system.service.dto.RoleDto;
|
|
||||||
import org.nl.modules.system.service.dto.RoleSmallDto;
|
|
||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.ResultBean;
|
import org.nl.modules.wql.core.bean.ResultBean;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
@@ -41,9 +34,9 @@ import org.springframework.cache.annotation.CacheConfig;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ludj
|
* @author ludj
|
||||||
@@ -51,11 +44,8 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CacheConfig(cacheNames = "role")
|
|
||||||
public class RoleServiceImpl implements RoleService {
|
public class RoleServiceImpl implements RoleService {
|
||||||
|
|
||||||
private final RedisUtils redisUtils;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject queryAll(Map whereJson, Pageable page) {
|
public JSONObject queryAll(Map whereJson, Pageable page) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_role");
|
WQLObject wo = WQLObject.getWQLObject("sys_role");
|
||||||
@@ -94,7 +84,6 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
form.put("update_name", SecurityUtils.getCurrentNickName());
|
form.put("update_name", SecurityUtils.getCurrentNickName());
|
||||||
form.put("update_time", DateUtil.now());
|
form.put("update_time", DateUtil.now());
|
||||||
roleTab.insert(form);
|
roleTab.insert(form);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@CacheConfig(cacheNames = "user")
|
|
||||||
public class UserServiceImpl implements UserService {
|
public class UserServiceImpl implements UserService {
|
||||||
|
|
||||||
private final FileProperties properties;
|
private final FileProperties properties;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import cn.hutool.db.Db;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.wql.WQLCore;
|
import org.nl.modules.wql.WQLCore;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||||
|
|
||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
@@ -78,8 +80,8 @@ public class DBPoolSpring {
|
|||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
DataSource dataSource = SpringContextHolder.getBean(name);
|
DataSource dataSource = SpringContextHolder.getBean(name);
|
||||||
conn=Db.use(dataSource).getConnection();
|
// conn=Db.use(dataSource).getConnection();
|
||||||
// conn = DataSourceUtils.getConnection(dataSource);
|
conn = DataSourceUtils.getConnection(dataSource);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("不能获得Spring连接池中的数据库连接:" + e.toString());
|
log.error("不能获得Spring连接池中的数据库连接:" + e.toString());
|
||||||
}
|
}
|
||||||
@@ -120,9 +122,10 @@ public class DBPoolSpring {
|
|||||||
// conn.close();
|
// conn.close();
|
||||||
// }
|
// }
|
||||||
DataSource dataSource = (DataSource) SpringContextHolder.getBean(name);
|
DataSource dataSource = (DataSource) SpringContextHolder.getBean(name);
|
||||||
// DataSourceUtils.releaseConnection(conn, dataSource);
|
DataSourceUtils.releaseConnection(conn, dataSource);
|
||||||
|
|
||||||
Db.use(dataSource).closeConnection(conn);
|
|
||||||
|
/* Db.use(dataSource).closeConnection(conn);*/
|
||||||
// } catch (SQLException e) {
|
// } catch (SQLException e) {
|
||||||
// log.error("数据库连接关闭:"+e.toString() );
|
// log.error("数据库连接关闭:"+e.toString() );
|
||||||
// }
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user