mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-26 16:26:41 +08:00
JeecgBoot 2.4.2 积木报表版本发布,基于SpringBoot的低代码平台
This commit is contained in:
@ -2,13 +2,11 @@ package org.jeecg;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.apache.tomcat.util.scan.StandardJarScanner;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@ -19,7 +17,7 @@ import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* 单体启动类(采用此类启动项目为单体模式)
|
||||
* 单体启动类(采用此类启动为单体模式)
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
@ -50,22 +48,16 @@ public class JeecgSystemApplication extends SpringBootServletInitializer {
|
||||
*/
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcatFactory() {
|
||||
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(){
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory() {
|
||||
@Override
|
||||
protected void postProcessContext(Context context) {
|
||||
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
|
||||
}
|
||||
};
|
||||
|
||||
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
|
||||
@Override
|
||||
public void customize(Connector connector) {
|
||||
connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
|
||||
connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
|
||||
}
|
||||
factory.addConnectorCustomizers(connector -> {
|
||||
connector.setProperty("relaxedPathChars", "[]{}");
|
||||
connector.setProperty("relaxedQueryChars", "[]{}");
|
||||
});
|
||||
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,13 @@
|
||||
package org.jeecg.modules.init;
|
||||
package org.jeecg.config.init;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.config.JeecgCloudCondition;
|
||||
import org.jeecg.modules.system.service.ISysGatewayRouteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -15,6 +17,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Conditional(JeecgCloudCondition.class)
|
||||
public class SystemInitListener implements ApplicationListener<ApplicationReadyEvent>, Ordered {
|
||||
|
||||
|
||||
@ -24,7 +27,7 @@ public class SystemInitListener implements ApplicationListener<ApplicationReadyE
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||
|
||||
log.info(" 服务已启动,准备初始化路由配置 ###################");
|
||||
log.info(" 服务已启动,初始化路由配置 ###################");
|
||||
if (applicationReadyEvent.getApplicationContext().getDisplayName().indexOf("AnnotationConfigServletWebServerApplicationContext") > -1) {
|
||||
sysGatewayRouteService.addRoute2Redis(CacheConstant.GATEWAY_ROUTES);
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package org.jeecg.config.jimureport;
|
||||
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 自定义积木报表鉴权实现类(如果不进行自定义,则所有请求不做权限控制)
|
||||
* 1.自定义获取登录token
|
||||
* 2.自定义获取登录用户
|
||||
*/
|
||||
@Component
|
||||
class JimuReportTokenService implements JmReportTokenServiceI {
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
public String getToken(HttpServletRequest request) {
|
||||
return TokenUtils.getTokenByRequest(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername(String token) {
|
||||
return JwtUtil.getUsername(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean verifyToken(String token) {
|
||||
return TokenUtils.verifyToken(token, sysBaseAPI, redisUtil);
|
||||
}
|
||||
}
|
||||
@ -482,7 +482,17 @@ public class SystemAPIController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 37根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* 37根据多个用户id(逗号分隔),查询返回多个用户信息
|
||||
* @param usernames
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryUsersByIds")
|
||||
List<JSONObject> queryUsersByIds(String ids){
|
||||
return this.sysBaseAPI.queryUsersByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 38根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* @param orgCodes
|
||||
* @return
|
||||
*/
|
||||
@ -490,4 +500,25 @@ public class SystemAPIController {
|
||||
List<JSONObject> queryDepartsByOrgcodes(String orgCodes){
|
||||
return this.sysBaseAPI.queryDepartsByOrgcodes(orgCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 39根据多个部门ID(逗号分隔),查询返回多个部门信息
|
||||
* @param orgCodes
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryDepartsByIds")
|
||||
List<JSONObject> queryDepartsByIds(String orgCodes){
|
||||
return this.sysBaseAPI.queryDepartsByIds(orgCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 40发送邮件消息
|
||||
* @param email
|
||||
* @param title
|
||||
* @param content
|
||||
*/
|
||||
@GetMapping("/sendEmailMsg")
|
||||
public void sendEmailMsg(String email,String title,String content){
|
||||
this.sysBaseAPI.sendEmailMsg(email,title,content);
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.message.websocket;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.jeecg.boot.starter.redis.listener.JeecgRedisListerer;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 监听消息(采用redis发布订阅方式发送消息)
|
||||
*/
|
||||
@Component
|
||||
public class SocketHandler implements JeecgRedisListerer {
|
||||
|
||||
@Autowired
|
||||
private WebSocket webSocket;
|
||||
|
||||
@Override
|
||||
public void onMessage(BaseMap map) {
|
||||
String userId = map.get("userId");
|
||||
String message = map.get("message");
|
||||
if (ObjectUtil.isNotEmpty(userId)) {
|
||||
webSocket.pushMessage(userId, message);
|
||||
} else {
|
||||
webSocket.pushMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@ public class TestSocketController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
obj.put(WebsocketConst.MSG_ID, "M0001");
|
||||
obj.put(WebsocketConst.MSG_TXT, message);
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
result.setResult("群发!");
|
||||
return result;
|
||||
}
|
||||
@ -40,7 +40,7 @@ public class TestSocketController {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, userId);
|
||||
obj.put(WebsocketConst.MSG_ID, "M0001");
|
||||
obj.put(WebsocketConst.MSG_TXT, message);
|
||||
webSocket.sendOneMessage(userId, obj.toJSONString());
|
||||
webSocket.sendMessage(userId, obj.toJSONString());
|
||||
result.setResult("单发");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
package org.jeecg.modules.message.websocket;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.websocket.OnClose;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.OnOpen;
|
||||
@ -11,6 +13,10 @@ import javax.websocket.Session;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.jeecg.boot.starter.redis.client.JeecgRedisClient;
|
||||
import org.jeecg.boot.starter.redis.listener.JeecgRedisListerer;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.common.constant.WebsocketConst;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -27,83 +33,121 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
@ServerEndpoint("/websocket/{userId}") //此注解相当于设置访问URL
|
||||
public class WebSocket {
|
||||
|
||||
|
||||
private Session session;
|
||||
|
||||
private static CopyOnWriteArraySet<WebSocket> webSockets =new CopyOnWriteArraySet<>();
|
||||
private static Map<String,Session> sessionPool = new HashMap<String,Session>();
|
||||
|
||||
|
||||
private String userId;
|
||||
|
||||
private static final String REDIS_TOPIC_NAME = "socketHandler";
|
||||
|
||||
@Resource
|
||||
private JeecgRedisClient jeecgRedisClient;
|
||||
|
||||
private static CopyOnWriteArraySet<WebSocket> webSockets = new CopyOnWriteArraySet<>();
|
||||
private static Map<String, Session> sessionPool = new HashMap<String, Session>();
|
||||
|
||||
|
||||
@OnOpen
|
||||
public void onOpen(Session session, @PathParam(value="userId")String userId) {
|
||||
public void onOpen(Session session, @PathParam(value = "userId") String userId) {
|
||||
try {
|
||||
this.session = session;
|
||||
webSockets.add(this);
|
||||
sessionPool.put(userId, session);
|
||||
log.info("【websocket消息】有新的连接,总数为:"+webSockets.size());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
this.session = session;
|
||||
this.userId = userId;
|
||||
webSockets.add(this);
|
||||
sessionPool.put(userId, session);
|
||||
log.info("【websocket消息】有新的连接,总数为:" + webSockets.size());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OnClose
|
||||
public void onClose() {
|
||||
try {
|
||||
webSockets.remove(this);
|
||||
log.info("【websocket消息】连接断开,总数为:"+webSockets.size());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@OnMessage
|
||||
public void onMessage(String message) {
|
||||
//todo 现在有个定时任务刷,应该去掉
|
||||
log.debug("【websocket消息】收到客户端消息:"+message);
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_CHECK);//业务类型
|
||||
obj.put(WebsocketConst.MSG_TXT, "心跳响应");//消息内容
|
||||
session.getAsyncRemote().sendText(obj.toJSONString());
|
||||
}
|
||||
|
||||
// 此为广播消息
|
||||
public void sendAllMessage(String message) {
|
||||
log.info("【websocket消息】广播消息:"+message);
|
||||
for(WebSocket webSocket : webSockets) {
|
||||
try {
|
||||
if(webSocket.session.isOpen()) {
|
||||
webSocket.session.getAsyncRemote().sendText(message);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
webSockets.remove(this);
|
||||
sessionPool.remove(this.userId);
|
||||
log.info("【websocket消息】连接断开,总数为:" + webSockets.size());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
// 此为单点消息
|
||||
public void sendOneMessage(String userId, String message) {
|
||||
|
||||
|
||||
/**
|
||||
* 服务端推送消息
|
||||
*
|
||||
* @param userId
|
||||
* @param message
|
||||
*/
|
||||
public void pushMessage(String userId, String message) {
|
||||
Session session = sessionPool.get(userId);
|
||||
if (session != null&&session.isOpen()) {
|
||||
if (session != null && session.isOpen()) {
|
||||
try {
|
||||
log.info("【websocket消息】 单点消息:"+message);
|
||||
log.info("【websocket消息】 单点消息:" + message);
|
||||
session.getAsyncRemote().sendText(message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 此为单点消息(多人)
|
||||
public void sendMoreMessage(String[] userIds, String message) {
|
||||
for(String userId:userIds) {
|
||||
Session session = sessionPool.get(userId);
|
||||
if (session != null&&session.isOpen()) {
|
||||
try {
|
||||
log.info("【websocket消息】 单点消息:"+message);
|
||||
session.getAsyncRemote().sendText(message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 服务器端推送消息
|
||||
*/
|
||||
public void pushMessage(String message) {
|
||||
try {
|
||||
webSockets.forEach(ws -> ws.session.getAsyncRemote().sendText(message));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OnMessage
|
||||
public void onMessage(String message) {
|
||||
//todo 现在有个定时任务刷,应该去掉
|
||||
log.debug("【websocket消息】收到客户端消息:" + message);
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_CHECK);//业务类型
|
||||
obj.put(WebsocketConst.MSG_TXT, "心跳响应");//消息内容
|
||||
for (WebSocket webSocket : webSockets) {
|
||||
webSocket.pushMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台发送消息到redis
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public void sendMessage(String message) {
|
||||
log.info("【websocket消息】广播消息:" + message);
|
||||
BaseMap baseMap = new BaseMap();
|
||||
baseMap.put("userId", "");
|
||||
baseMap.put("message", message);
|
||||
jeecgRedisClient.sendMessage(REDIS_TOPIC_NAME, baseMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 此为单点消息
|
||||
*
|
||||
* @param userId
|
||||
* @param message
|
||||
*/
|
||||
public void sendMessage(String userId, String message) {
|
||||
BaseMap baseMap = new BaseMap();
|
||||
baseMap.put("userId", userId);
|
||||
baseMap.put("message", message);
|
||||
jeecgRedisClient.sendMessage(REDIS_TOPIC_NAME, baseMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 此为单点消息(多人)
|
||||
*
|
||||
* @param userIds
|
||||
* @param message
|
||||
*/
|
||||
public void sendMessage(String[] userIds, String message) {
|
||||
for (String userId : userIds) {
|
||||
sendMessage(userId, message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,15 +1,7 @@
|
||||
package org.jeecg.modules.monitor.controller;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.monitor.service.RedisService;
|
||||
@ -18,7 +10,14 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -45,6 +44,35 @@ public class ActuatorRedisController {
|
||||
return redisService.getKeysSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取redis key数量 for 报表
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/keysSizeForReport")
|
||||
public Map<String, JSONArray> getKeysSizeReport() throws Exception {
|
||||
return redisService.getMapForReport("1");
|
||||
}
|
||||
/**
|
||||
* 获取redis 内存 for 报表
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/memoryForReport")
|
||||
public Map<String, JSONArray> memoryForReport() throws Exception {
|
||||
return redisService.getMapForReport("2");
|
||||
}
|
||||
/**
|
||||
* 获取redis 全部信息 for 报表
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/infoForReport")
|
||||
public Map<String, JSONArray> infoForReport() throws Exception {
|
||||
return redisService.getMapForReport("3");
|
||||
}
|
||||
|
||||
@GetMapping("/memoryInfo")
|
||||
public Map<String, Object> getMemoryInfo() throws Exception {
|
||||
return redisService.getMemoryInfo();
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.monitor.exception.RedisConnectException;
|
||||
|
||||
@ -29,5 +30,10 @@ public interface RedisService {
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getMemoryInfo() throws RedisConnectException;
|
||||
|
||||
/**
|
||||
* 获取 报表需要个redis信息
|
||||
*
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, JSONArray> getMapForReport(String type) throws RedisConnectException ;
|
||||
}
|
||||
|
||||
@ -8,10 +8,15 @@ import java.util.Properties;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.monitor.exception.RedisConnectException;
|
||||
import org.jeecg.modules.monitor.service.RedisService;
|
||||
import org.springframework.cglib.beans.BeanMap;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -72,4 +77,46 @@ public class RedisServiceImpl implements RedisService {
|
||||
log.info("--getMemoryInfo--: " + map.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询redis信息for报表
|
||||
* @param type 1redis key数量 2 占用内存 3redis信息
|
||||
* @return
|
||||
* @throws RedisConnectException
|
||||
*/
|
||||
@Override
|
||||
public Map<String, JSONArray> getMapForReport(String type) throws RedisConnectException {
|
||||
Map<String,JSONArray> mapJson=new HashMap<String, JSONArray> ();
|
||||
JSONArray json = new JSONArray();
|
||||
if("3".equals(type)){
|
||||
List<RedisInfo> redisInfo = getRedisInfo();
|
||||
for(RedisInfo info:redisInfo){
|
||||
Map<String, Object> map= Maps.newHashMap();
|
||||
BeanMap beanMap = BeanMap.create(info);
|
||||
for (Object key : beanMap.keySet()) {
|
||||
map.put(key+"", beanMap.get(key));
|
||||
}
|
||||
json.add(map);
|
||||
}
|
||||
mapJson.put("data",json);
|
||||
return mapJson;
|
||||
}
|
||||
for(int i = 0; i < 5; i++){
|
||||
JSONObject jo = new JSONObject();
|
||||
Map<String, Object> map;
|
||||
if("1".equals(type)){
|
||||
map= getKeysSize();
|
||||
jo.put("value",map.get("dbSize"));
|
||||
}else{
|
||||
map = getMemoryInfo();
|
||||
Integer used_memory = Integer.valueOf(map.get("used_memory").toString());
|
||||
jo.put("value",used_memory/1000);
|
||||
}
|
||||
String create_time = DateUtil.formatTime(DateUtil.date((Long) map.get("create_time")-(4-i)*1000));
|
||||
jo.put("name",create_time);
|
||||
json.add(jo);
|
||||
}
|
||||
mapJson.put("data",json);
|
||||
return mapJson;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("ngAlainService")
|
||||
@Transactional
|
||||
public class NgAlainServiceImpl implements NgAlainService {
|
||||
@Autowired
|
||||
private ISysPermissionService sysPermissionService;
|
||||
|
||||
@ -21,7 +21,10 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setFileName(fileName);
|
||||
String url = OssBootUtil.upload(multipartFile,"upload/test");
|
||||
ossFile.setUrl(url);
|
||||
//update-begin--Author:scott Date:20201227 for:JT-361【文件预览】阿里云原生域名可以文件预览,自己映射域名kkfileview提示文件下载失败-------------------
|
||||
// 返回阿里云原生域名前缀URL
|
||||
ossFile.setUrl(OssBootUtil.getOriginalUrl(url));
|
||||
//update-end--Author:scott Date:20201227 for:JT-361【文件预览】阿里云原生域名可以文件预览,自己映射域名kkfileview提示文件下载失败-------------------
|
||||
this.save(ossFile);
|
||||
}
|
||||
|
||||
|
||||
@ -96,10 +96,6 @@ public class SysAnnouncementController {
|
||||
}
|
||||
}
|
||||
IPage<SysAnnouncement> pageList = sysAnnouncementService.page(page, queryWrapper);
|
||||
log.info("查询当前页:"+pageList.getCurrent());
|
||||
log.info("查询当前页数量:"+pageList.getSize());
|
||||
log.info("查询结果数量:"+pageList.getRecords().size());
|
||||
log.info("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
@ -233,7 +229,7 @@ public class SysAnnouncementController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
obj.put(WebsocketConst.MSG_ID, sysAnnouncement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile());
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
}else {
|
||||
// 2.插入用户通告阅读标记表记录
|
||||
String userId = sysAnnouncement.getUserIds();
|
||||
@ -244,7 +240,7 @@ public class SysAnnouncementController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_USER);
|
||||
obj.put(WebsocketConst.MSG_ID, sysAnnouncement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile());
|
||||
webSocket.sendMoreMessage(userIds, obj.toJSONString());
|
||||
webSocket.sendMessage(userIds, obj.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -285,15 +281,14 @@ public class SysAnnouncementController {
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = sysUser.getId();
|
||||
// 1.将系统消息补充到用户通告阅读标记表中
|
||||
Collection<String> anntIds = sysAnnouncementSendService.queryByUserId(userId);
|
||||
LambdaQueryWrapper<SysAnnouncement> querySaWrapper = new LambdaQueryWrapper<SysAnnouncement>();
|
||||
querySaWrapper.eq(SysAnnouncement::getMsgType,CommonConstant.MSG_TYPE_ALL); // 全部人员
|
||||
querySaWrapper.eq(SysAnnouncement::getDelFlag,CommonConstant.DEL_FLAG_0.toString()); // 未删除
|
||||
querySaWrapper.eq(SysAnnouncement::getSendStatus, CommonConstant.HAS_SEND); //已发布
|
||||
querySaWrapper.ge(SysAnnouncement::getEndTime, sysUser.getCreateTime()); //新注册用户不看结束通知
|
||||
if(anntIds!=null&&anntIds.size()>0) {
|
||||
querySaWrapper.notIn(SysAnnouncement::getId, anntIds);
|
||||
}
|
||||
//update-begin--Author:liusq Date:20210108 for:[JT-424] 【开源issue】bug处理--------------------
|
||||
querySaWrapper.notInSql(SysAnnouncement::getId,"select annt_id from sys_announcement_send where user_id='"+userId+"'");
|
||||
//update-begin--Author:liusq Date:20210108 for: [JT-424] 【开源issue】bug处理--------------------
|
||||
List<SysAnnouncement> announcements = sysAnnouncementService.list(querySaWrapper);
|
||||
if(announcements.size()>0) {
|
||||
for(int i=0;i<announcements.size();i++) {
|
||||
@ -337,9 +332,10 @@ public class SysAnnouncementController {
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(SysAnnouncement sysAnnouncement,HttpServletRequest request) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<SysAnnouncement> queryWrapper = QueryGenerator.initQueryWrapper(sysAnnouncement, request.getParameterMap());
|
||||
LambdaQueryWrapper<SysAnnouncement> queryWrapper = new LambdaQueryWrapper<SysAnnouncement>(sysAnnouncement);
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
queryWrapper.eq(SysAnnouncement::getDelFlag,CommonConstant.DEL_FLAG_0);
|
||||
List<SysAnnouncement> pageList = sysAnnouncementService.list(queryWrapper);
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "系统通告列表");
|
||||
@ -407,7 +403,7 @@ public class SysAnnouncementController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
obj.put(WebsocketConst.MSG_ID, sysAnnouncement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile());
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
}else {
|
||||
// 2.插入用户通告阅读标记表记录
|
||||
String userId = sysAnnouncement.getUserIds();
|
||||
@ -416,14 +412,14 @@ public class SysAnnouncementController {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_USER);
|
||||
obj.put(WebsocketConst.MSG_ID, sysAnnouncement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile());
|
||||
webSocket.sendMoreMessage(userIds, obj.toJSONString());
|
||||
webSocket.sendMessage(userIds, obj.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
obj.put(WebsocketConst.MSG_TXT, "批量设置已读");
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -136,10 +136,8 @@ public class SysCategoryController {
|
||||
if(sysCategory==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysCategoryService.removeById(id);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
this.sysCategoryService.deleteSysCategory(id);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -156,7 +154,7 @@ public class SysCategoryController {
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.sysCategoryService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
this.sysCategoryService.deleteSysCategory(ids);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
@ -461,6 +459,26 @@ public class SysCategoryController {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父级id批量查询子节点
|
||||
* @param parentIds
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getChildListBatch")
|
||||
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) {
|
||||
try {
|
||||
QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<>();
|
||||
List<String> parentIdList = Arrays.asList(parentIds.split(","));
|
||||
queryWrapper.in("pid", parentIdList);
|
||||
List<SysCategory> list = sysCategoryService.list(queryWrapper);
|
||||
IPage<SysCategory> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("批量查询子节点失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -16,13 +16,11 @@ import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.system.vo.DictQuery;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.FieldPresenceUtil;
|
||||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.SqlInjectionUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysDict;
|
||||
import org.jeecg.modules.system.entity.SysDictItem;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.model.SysDictTree;
|
||||
import org.jeecg.modules.system.model.TreeSelectModel;
|
||||
import org.jeecg.modules.system.service.ISysDictItemService;
|
||||
@ -32,6 +30,7 @@ import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.result.ExcelImportResult;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -41,6 +40,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
@ -152,7 +152,7 @@ public class SysDictController {
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
log.info(result.toString());
|
||||
log.debug(result.toString());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
@ -202,7 +202,10 @@ public class SysDictController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET)
|
||||
public Result<List<DictModel>> loadDict(@PathVariable String dictCode,@RequestParam(name="keyword") String keyword, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) {
|
||||
public Result<List<DictModel>> loadDict(@PathVariable String dictCode,
|
||||
@RequestParam(name="keyword") String keyword,
|
||||
@RequestParam(value = "sign",required = false) String sign,
|
||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
||||
log.info(" 加载字典表数据,加载关键字: "+ keyword);
|
||||
Result<List<DictModel>> result = new Result<List<DictModel>>();
|
||||
List<DictModel> ls = null;
|
||||
@ -213,7 +216,11 @@ public class SysDictController {
|
||||
result.error500("字典Code格式不正确!");
|
||||
return result;
|
||||
}
|
||||
ls = sysDictService.queryTableDictItems(params[0],params[1],params[2],keyword);
|
||||
if(pageSize!=null){
|
||||
ls = sysDictService.queryLittleTableDictItems(params[0],params[1],params[2],keyword, pageSize);
|
||||
}else{
|
||||
ls = sysDictService.queryTableDictItems(params[0],params[1],params[2],keyword);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
log.info(result.toString());
|
||||
@ -312,7 +319,7 @@ public class SysDictController {
|
||||
* @param sysDict
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysDict> add(@RequestBody SysDict sysDict) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
@ -333,7 +340,7 @@ public class SysDictController {
|
||||
* @param sysDict
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<SysDict> edit(@RequestBody SysDict sysDict) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
@ -355,7 +362,7 @@ public class SysDictController {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
|
||||
public Result<SysDict> delete(@RequestParam(name="id",required=true) String id) {
|
||||
@ -374,7 +381,7 @@ public class SysDictController {
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value= CacheConstant.SYS_DICT_CACHE, allEntries=true)
|
||||
public Result<SysDict> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
@ -400,10 +407,14 @@ public class SysDictController {
|
||||
Set keys2 = redisTemplate.keys(CacheConstant.SYS_DICT_TABLE_CACHE + "*");
|
||||
Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*");
|
||||
Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*");
|
||||
Set keys5 = redisTemplate.keys( "jmreport:cache:dict*");
|
||||
Set keys6 = redisTemplate.keys( "jmreport:cache:dictTable*");
|
||||
redisTemplate.delete(keys);
|
||||
redisTemplate.delete(keys2);
|
||||
redisTemplate.delete(keys3);
|
||||
redisTemplate.delete(keys4);
|
||||
redisTemplate.delete(keys5);
|
||||
redisTemplate.delete(keys6);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -449,7 +460,7 @@ public class SysDictController {
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
@ -461,12 +472,11 @@ public class SysDictController {
|
||||
params.setHeadRows(2);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
//update-begin-author:wangshuai date:20201030 for:导入测试用例
|
||||
boolean aBoolean = FieldPresenceUtil.fieldPresence(file.getInputStream(), SysDictPage.class, params);
|
||||
if(!aBoolean){
|
||||
throw new RuntimeException("导入Excel标题格式不匹配!");
|
||||
//导入Excel格式校验,看匹配的字段文本概率
|
||||
ExcelImportResult t = ExcelImportUtil.importExcelVerify(file.getInputStream(), SysDictPage.class, params);
|
||||
if(t.isVerfiyFail()){
|
||||
throw new RuntimeException("导入Excel校验失败 !");
|
||||
}
|
||||
//update-end-author:wangshuai date:20201030 for:导入测试用例
|
||||
List<SysDictPage> list = ExcelImportUtil.importExcel(file.getInputStream(), SysDictPage.class, params);
|
||||
// 错误信息
|
||||
List<String> errorMessage = new ArrayList<>();
|
||||
|
||||
@ -6,6 +6,9 @@ import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
@ -148,5 +151,33 @@ public class SysDictItemController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典值重复校验
|
||||
* @param sysDictItem
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/dictItemCheck", method = RequestMethod.GET)
|
||||
@ApiOperation("字典重复校验接口")
|
||||
public Result<Object> doDictItemCheck(SysDictItem sysDictItem, HttpServletRequest request) {
|
||||
int num = 0;
|
||||
LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<SysDictItem>();
|
||||
queryWrapper.eq(SysDictItem::getItemValue,sysDictItem.getItemValue());
|
||||
queryWrapper.eq(SysDictItem::getDictId,sysDictItem.getDictId());
|
||||
if (StringUtils.isNotBlank(sysDictItem.getId())) {
|
||||
// 编辑页面校验
|
||||
queryWrapper.ne(SysDictItem::getId,sysDictItem.getId());
|
||||
}
|
||||
num = sysDictItemService.count(queryWrapper);
|
||||
if (num == 0) {
|
||||
// 该值可用
|
||||
return Result.ok("该值可用!");
|
||||
} else {
|
||||
// 该值不可用
|
||||
log.info("该值不可用,系统中已存在!");
|
||||
return Result.error("该值不可用,系统中已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -472,6 +472,7 @@ public class SysPermissionController {
|
||||
json = new JSONObject();
|
||||
json.put("action", permission.getPerms());
|
||||
json.put("status", permission.getStatus());
|
||||
//1显示2禁用
|
||||
json.put("type", permission.getPermsType());
|
||||
json.put("describe", permission.getName());
|
||||
jsonArray.add(json);
|
||||
|
||||
@ -460,7 +460,7 @@ public class SysUserController {
|
||||
successLines++;
|
||||
} catch (Exception e) {
|
||||
errorLines++;
|
||||
String message = e.getMessage();
|
||||
String message = e.getMessage().toLowerCase();
|
||||
int lineNumber = i + 1;
|
||||
// 通过索引名判断出错信息
|
||||
if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_USER_USERNAME)) {
|
||||
@ -1043,10 +1043,10 @@ public class SysUserController {
|
||||
if (oConvertUtils.isEmpty(token)) {
|
||||
username = JwtUtil.getUserNameByToken(request);
|
||||
} else {
|
||||
username = JwtUtil.getUsername(token);
|
||||
username = JwtUtil.getUsername(token);
|
||||
}
|
||||
|
||||
log.info(" ------ 通过令牌获取部分用户信息,当前用户: " + username);
|
||||
log.debug(" ------ 通过令牌获取部分用户信息,当前用户: " + username);
|
||||
|
||||
// 根据用户名查询用户信息
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
@ -1056,7 +1056,7 @@ public class SysUserController {
|
||||
map.put("sysUserName", sysUser.getRealname()); // 当前登录用户真实名称
|
||||
map.put("sysOrgCode", sysUser.getOrgCode()); // 当前登录用户部门编号
|
||||
|
||||
log.info(" ------ 通过令牌获取部分用户信息,已获取的用户信息: " + map);
|
||||
log.debug(" ------ 通过令牌获取部分用户信息,已获取的用户信息: " + map);
|
||||
|
||||
return Result.ok(map);
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -1,17 +1,14 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 分类字典
|
||||
|
||||
@ -47,7 +47,7 @@ public class SysDepart implements Serializable {
|
||||
/**描述*/
|
||||
@Excel(name="描述",width=15)
|
||||
private String description;
|
||||
/**机构类别 1组织机构,2岗位*/
|
||||
/**机构类别 1公司,2组织机构,2岗位*/
|
||||
@Excel(name="机构类别",width=15,dicCode="org_category")
|
||||
private String orgCategory;
|
||||
/**机构类型*/
|
||||
|
||||
@ -72,10 +72,10 @@ public class SysGatewayRoute implements Serializable {
|
||||
private Integer retryable;
|
||||
|
||||
/**是否为保留数据:0-否 1-是*/
|
||||
@Excel(name = "是否重试", width = 15)
|
||||
@Excel(name = "保留数据", width = 15)
|
||||
@ApiModelProperty(value = "保留数据")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer persist;
|
||||
private Integer persistable;
|
||||
|
||||
/**是否在接口文档中展示:0-否 1-是*/
|
||||
@Excel(name = "在接口文档中展示", width = 15)
|
||||
|
||||
@ -3,6 +3,7 @@ package org.jeecg.modules.system.mapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultType;
|
||||
@ -74,7 +75,19 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public List<DictModel> queryTableDictItems(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("keyword") String keyword);
|
||||
public List<DictModel> queryTableDictItems(@Param("table") String table,@Param("text") String text,@Param("code") String code,@Param("keyword") String keyword);
|
||||
|
||||
|
||||
/**
|
||||
* 通过关键字查询出字典表
|
||||
* @param page
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
IPage<DictModel> queryTableDictItems(Page<DictModel> page, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* 根据表名、显示字段名、存储字段名 查询树
|
||||
|
||||
@ -52,5 +52,11 @@ public interface ISysCategoryService extends IService<SysCategory> {
|
||||
* @return
|
||||
*/
|
||||
public String queryIdByCode(String code);
|
||||
|
||||
/**
|
||||
* 删除节点时同时删除子节点及修改父级节点
|
||||
* @param ids
|
||||
*/
|
||||
void deleteSysCategory(String ids);
|
||||
|
||||
}
|
||||
|
||||
@ -73,7 +73,16 @@ public interface ISysDictService extends IService<SysDict> {
|
||||
*/
|
||||
@Deprecated
|
||||
public List<DictModel> queryTableDictItems(String table, String text, String code,String keyword);
|
||||
|
||||
|
||||
/**
|
||||
* 查询字典表数据 只查询前10条
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
public List<DictModel> queryLittleTableDictItems(String table, String text, String code,String keyword, int pageSize);
|
||||
/**
|
||||
* 根据表名、显示字段名、存储字段名 查询树
|
||||
* @param table
|
||||
|
||||
@ -27,6 +27,7 @@ import org.jeecg.common.util.SysAnnmentTypeEnum;
|
||||
import org.jeecg.common.util.YouBianCodeUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
import org.jeecg.modules.message.handle.impl.EmailSendMsgHandle;
|
||||
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
||||
import org.jeecg.modules.message.websocket.WebSocket;
|
||||
import org.jeecg.modules.system.entity.*;
|
||||
@ -324,7 +325,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
if(map!=null) {
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
String str = "${" + entry.getKey() + "}";
|
||||
title = title.replace(str, entry.getValue());
|
||||
if(oConvertUtils.isNotEmpty(title)){
|
||||
title = title.replace(str, entry.getValue());
|
||||
}
|
||||
content = content.replace(str, entry.getValue());
|
||||
}
|
||||
}
|
||||
@ -360,7 +363,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, sysUser.getId());
|
||||
obj.put(WebsocketConst.MSG_ID, announcement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, announcement.getTitile());
|
||||
webSocket.sendOneMessage(sysUser.getId(), obj.toJSONString());
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,7 +430,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, sysUser.getId());
|
||||
obj.put(WebsocketConst.MSG_ID, announcement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, announcement.getTitile());
|
||||
webSocket.sendOneMessage(sysUser.getId(), obj.toJSONString());
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -666,7 +669,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
public void sendWebSocketMsg(String[] userIds, String cmd) {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, cmd);
|
||||
webSocket.sendMoreMessage(userIds, obj.toJSONString());
|
||||
webSocket.sendMessage(userIds, obj.toJSONString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -693,7 +696,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_SIGN);
|
||||
obj.put(WebsocketConst.MSG_USER_ID,userId);
|
||||
//TODO 目前全部推送,后面修改
|
||||
webSocket.sendAllMessage(obj.toJSONString());
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -853,6 +856,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return JSON.parseArray(JSON.toJSONString(userMapper.selectList(queryWrapper))).toJavaList(JSONObject.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryUsersByIds(String ids) {
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SysUser::getId,ids.split(","));
|
||||
return JSON.parseArray(JSON.toJSONString(userMapper.selectList(queryWrapper))).toJavaList(JSONObject.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 37根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
* @param usernames
|
||||
@ -865,6 +875,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return JSON.parseArray(JSON.toJSONString(sysDepartService.list(queryWrapper))).toJavaList(JSONObject.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryDepartsByIds(String ids) {
|
||||
LambdaQueryWrapper<SysDepart> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SysDepart::getId,ids.split(","));
|
||||
return JSON.parseArray(JSON.toJSONString(sysDepartService.list(queryWrapper))).toJavaList(JSONObject.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发消息
|
||||
* @param fromUser
|
||||
@ -905,7 +922,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, sysUser.getId());
|
||||
obj.put(WebsocketConst.MSG_ID, announcement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, announcement.getTitile());
|
||||
webSocket.sendOneMessage(sysUser.getId(), obj.toJSONString());
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -957,8 +974,21 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
obj.put(WebsocketConst.MSG_USER_ID, sysUser.getId());
|
||||
obj.put(WebsocketConst.MSG_ID, announcement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, announcement.getTitile());
|
||||
webSocket.sendOneMessage(sysUser.getId(), obj.toJSONString());
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件消息
|
||||
* @param email
|
||||
* @param title
|
||||
* @param content
|
||||
*/
|
||||
@Override
|
||||
public void sendEmailMsg(String email, String title, String content) {
|
||||
EmailSendMsgHandle emailHandle=new EmailSendMsgHandle();
|
||||
emailHandle.SendMsg(email, title, content);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,9 +1,12 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.jeecg.common.constant.FillRuleConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.FillRuleUtil;
|
||||
@ -17,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @Description: 分类字典
|
||||
@ -107,4 +111,97 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
|
||||
return baseMapper.queryIdByCode(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteSysCategory(String ids) {
|
||||
String allIds = this.queryTreeChildIds(ids);
|
||||
String pids = this.queryTreePids(ids);
|
||||
//1.删除时将节点下所有子节点一并删除
|
||||
this.baseMapper.deleteBatchIds(Arrays.asList(allIds.split(",")));
|
||||
//2.将父节点中已经没有下级的节点,修改为没有子节点
|
||||
if(oConvertUtils.isNotEmpty(pids)){
|
||||
LambdaUpdateWrapper<SysCategory> updateWrapper = new UpdateWrapper<SysCategory>()
|
||||
.lambda()
|
||||
.in(SysCategory::getId,Arrays.asList(pids.split(",")))
|
||||
.set(SysCategory::getHasChild,"0");
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点下所有子节点
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
private String queryTreeChildIds(String ids) {
|
||||
//获取id数组
|
||||
String[] idArr = ids.split(",");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (String pidVal : idArr) {
|
||||
if(pidVal != null){
|
||||
if(!sb.toString().contains(pidVal)){
|
||||
if(sb.toString().length() > 0){
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(pidVal);
|
||||
this.getTreeChildIds(pidVal,sb);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询需修改标识的父节点ids
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
private String queryTreePids(String ids) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
//获取id数组
|
||||
String[] idArr = ids.split(",");
|
||||
for (String id : idArr) {
|
||||
if(id != null){
|
||||
SysCategory category = this.baseMapper.selectById(id);
|
||||
//根据id查询pid值
|
||||
String metaPid = category.getPid();
|
||||
//查询此节点上一级是否还有其他子节点
|
||||
LambdaQueryWrapper<SysCategory> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysCategory::getPid,metaPid);
|
||||
queryWrapper.notIn(SysCategory::getId,Arrays.asList(idArr));
|
||||
List<SysCategory> dataList = this.baseMapper.selectList(queryWrapper);
|
||||
if((dataList == null || dataList.size()==0) && !Arrays.asList(idArr).contains(metaPid)
|
||||
&& !sb.toString().contains(metaPid)){
|
||||
//如果当前节点原本有子节点 现在木有了,更新状态
|
||||
sb.append(metaPid).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(sb.toString().endsWith(",")){
|
||||
sb = sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归 根据父id获取子节点id
|
||||
* @param pidVal
|
||||
* @param sb
|
||||
* @return
|
||||
*/
|
||||
private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){
|
||||
LambdaQueryWrapper<SysCategory> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysCategory::getPid,pidVal);
|
||||
List<SysCategory> dataList = baseMapper.selectList(queryWrapper);
|
||||
if(dataList != null && dataList.size()>0){
|
||||
for(SysCategory category : dataList) {
|
||||
if(!sb.toString().contains(category.getId())){
|
||||
sb.append(",").append(category.getId());
|
||||
}
|
||||
this.getTreeChildIds(category.getId(), sb);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -138,7 +139,9 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Cacheable(value = CacheConstant.SYS_DICT_TABLE_BY_KEYS_CACHE)
|
||||
//update-begin--Author:lvdandan Date:20201204 for:JT-36【online】树形列表bug修改后,还是显示原来值 暂时去掉缓存
|
||||
//@Cacheable(value = CacheConstant.SYS_DICT_TABLE_BY_KEYS_CACHE)
|
||||
//update-end--Author:lvdandan Date:20201204 for:JT-36【online】树形列表bug修改后,还是显示原来值 暂时去掉缓存
|
||||
public List<String> queryTableDictByKeys(String table, String text, String code, String keys) {
|
||||
if(oConvertUtils.isEmpty(keys)){
|
||||
return null;
|
||||
@ -201,6 +204,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
return baseMapper.queryTableDictItems(table, text, code, "%"+keyword+"%");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> queryLittleTableDictItems(String table, String text, String code, String keyword, int pageSize) {
|
||||
Page<DictModel> page = new Page<DictModel>(1, pageSize);
|
||||
IPage<DictModel> pageList = baseMapper.queryTableDictItems(page, table, text, code, "%"+keyword+"%");
|
||||
return pageList.getRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreeSelectModel> queryTreeList(Map<String, String> query,String table, String text, String code, String pidField,String pid,String hasChildField) {
|
||||
return baseMapper.queryTreeList(query,table, text, code, pidField, pid,hasChildField);
|
||||
|
||||
@ -79,6 +79,8 @@ public class SysThirdAccountServiceImpl extends ServiceImpl<SysThirdAccountMappe
|
||||
user.setSalt(salt);
|
||||
String passwordEncode = PasswordUtil.encrypt(user.getUsername(), "123456", salt);
|
||||
user.setPassword(passwordEncode);
|
||||
user.setRealname(account.getRealname());
|
||||
user.setAvatar(account.getAvatar());
|
||||
String s = this.saveThirdUser(user);
|
||||
//更新用户第三方账户表的userId
|
||||
SysThirdAccount sysThirdAccount = new SysThirdAccount();
|
||||
|
||||
Reference in New Issue
Block a user