Commit 23386991 authored by AfirSraftGarrier's avatar AfirSraftGarrier

修改

parent fc99621e
......@@ -101,15 +101,9 @@ public class OperateController {
@GetMapping("alarm/list")
@MyLog(title = "获取告警列表", businessType = BusinessType.SELECT)
public ResResult<List<AlarmVo>> getAlarmList() {
response.setHeader("Set-Cookie", "cookiename=cookievalue; path=/; Domain=domainvaule; Max-age=seconds; HttpOnly");
String user = UserUtils.getLoginUserId();
int userI = Integer.valueOf(user);
List<AlarmVo> alarmList = alarmService.getAlarmList(userI);
if (alarmList != null && !alarmList.isEmpty()) {
for (AlarmVo alarmVo : alarmList) {
alarmVo.setContent(ESAPI.encoder().encodeForHTML(alarmVo.getContent()));
}
}
return ResResult.success().goRecord(alarmList);
}
......
......@@ -7,6 +7,7 @@ import iot.sixiang.license.handler.IotLicenseException;
import iot.sixiang.license.mapper.AlarmMapper;
import iot.sixiang.license.model.vo.AlarmVo;
import iot.sixiang.license.service.AlarmService;
import org.owasp.esapi.ESAPI;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -31,6 +32,11 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements
}
List<AlarmVo> alarmVos = alarmMapper.getAlarmList(uI);
alarmVos = alarmVos.stream().sorted(Comparator.comparing(AlarmVo::getCreateTime, Comparator.reverseOrder())).collect(Collectors.toList());
if (alarmVos != null && !alarmVos.isEmpty()) {
for (AlarmVo alarmVo : alarmVos) {
alarmVo.setContent(ESAPI.encoder().encodeForHTML(alarmVo.getContent()));
}
}
return alarmVos;
}
}
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