Commit a66a63fb by 宋珺琪

日志导出问题、websocket问题

parent 5be8fe1d
......@@ -126,11 +126,16 @@ public class SkSysLogController {
}
queryWrapper.orderByDesc("createDate");
List list = service.list(queryWrapper);
ExportExcelUtil<SkService> exportExcelUtil = new ExportExcelUtil<>();
List<SkSysLog> list = service.list(queryWrapper);
List<SkSysLog> newList=new ArrayList<>();
for (SkSysLog s :list) {
s.setContent(StringUtil.toUTF8(s.getContent()));
newList.add(s);
}
ExportExcelUtil<SkSysLog> exportExcelUtil = new ExportExcelUtil<>();
String[] headersName = {"用户id","方法名","ip","请求url","传入参数","返回参数","响应时长","访问时间"};
String[] headersField = {"id","method","ip","url","params","content","totaltime","createdate"};
exportExcelUtil.exportExcel("DataStatistics", headersName, headersField, list, response,"日志列表信息");
exportExcelUtil.exportExcel("DataStatistics", headersName, headersField, newList, response,"日志列表信息");
}
@ApiOperation(value = "统计")
......
package com.founder.servicebase.meassage;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;
import javax.websocket.server.ServerEndpoint;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.util.Objects;
/**
* @author sjq
* @vesion 1.0
* @date 2022/11/23 11:42
* @since jdk1.8
*/
@Component
public class CustomBeanPostProcessor implements BeanPostProcessor {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
handleServerEndPoint(bean);
return bean;
}
private void handleServerEndPoint(Object bean) {
//获取serverEndpoint
ServerEndpoint serverEndpoint = AnnotationUtils.findAnnotation(bean.getClass(), ServerEndpoint.class);
if (!Objects.isNull(serverEndpoint)) {
//设置@ServerEndpoint注解支持继承,相当于注解@Inherited,应对动态代理导致类上的@ServerEndpoint注解丢失
InvocationHandler h = Proxy.getInvocationHandler(serverEndpoint);
try {
Field typeField = h.getClass().getDeclaredField("type");
typeField.setAccessible(true);
Field annotationTypeField = Class.class.getDeclaredField("annotationType");
annotationTypeField.setAccessible(true);
Object o = annotationTypeField.get(typeField.get(h));
Field inheritedField = o.getClass().getDeclaredField("inherited");
this.updateFinalModifiers(inheritedField);
inheritedField.set(o, true);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException("修改@ServerEndPoint注解失败");
}
}
}
private void updateFinalModifiers(Field field) throws NoSuchFieldException, IllegalAccessException {
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
}
}
\ No newline at end of file
......@@ -364,7 +364,7 @@ public class SkypDesktopController {
if(flag){
System.out.println("++++++++++++++++++++++日程定时1111");
WebSocketServer.SendMessage(WebSocketServer. map. get (userId),":你的("+skSchedule.getBz()+")日程到了,请尽快处理");
WebSocketServer.SendMessage(WebSocketServer. map. get (userId),"你的("+skSchedule.getBz()+")日程已经到了,请尽快处理");
System.out.println("++++++++++++++++++++++日程定时结束");
}
//当前时间
......@@ -379,7 +379,7 @@ public class SkypDesktopController {
Boolean flag1 = belongCalendar(Jzsj, date,kssj1);
if(flag1){
System.out.println("++++++++++++++++++++++日程定时1111");
WebSocketServer.SendMessage(WebSocketServer. map. get (userId),":你的("+skSchedule.getBz()+")日程快到了,请尽快处理");
WebSocketServer.SendMessage(WebSocketServer. map. get (userId),"你的("+skSchedule.getBz()+")日程快到了,请尽快处理");
System.out.println("++++++++++++++++++++++日程定时结束");
}
}
......
......@@ -7,6 +7,34 @@
"y": "28.190399",
"fileUrl": "http://47.92.48.137:1008/images/5.mp4",
"fileName": "视频1.mp4"
},{
"id": "2",
"time": "2022-03-01 10:57:08",
"x": "113.019318",
"y": "28.190398",
"fileUrl": "http://47.92.48.137:1008/images/6.avi",
"fileName": "视频2.avi"
},{
"id": "3",
"time": "2022-03-01 10:57:08",
"x": "113.019319",
"y": "28.190397",
"fileUrl": "http://47.92.48.137:1008/images/7.wmv",
"fileName": "视频3.wmv"
},{
"id": "4",
"time": "2022-03-01 10:57:08",
"x": "113.019315",
"y": "28.190395",
"fileUrl": "http://47.92.48.137:1008/images/5.mp4",
"fileName": "视频4.mp4"
},{
"id": "5",
"time": "2022-03-01 10:57:08",
"x": "113.019314",
"y": "28.190394",
"fileUrl": "http://47.92.48.137:1008/images/5.mp4",
"fileName": "视频5.mp4"
}
],
"photo": [
......@@ -65,6 +93,22 @@
"y": "28.18789116",
"fileUrl": "http://47.92.48.137:1008/images/5.jpg",
"fileName": "照片7.jpg"
},
{
"id": "8",
"time": "2022-03-01 10:57:08",
"x": "113.02123765",
"y": "28.18789156",
"fileUrl": "http://47.92.48.137:1008/images/5.jpg",
"fileName": "照片8.jpg"
},
{
"id": "9",
"time": "2022-03-01 10:57:08",
"x": "113.02123767",
"y": "28.18789166",
"fileUrl": "http://47.92.48.137:1008/images/5.jpg",
"fileName": "照片8.jpg"
}
]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment