Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
zhaoxianglong 11 months ago
parent
commit
fd1e6adcf7
  1. 18
      zc-business/src/main/java/com/zc/business/controller/DcBoardReleaseLogController.java
  2. 16
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java
  3. 123
      zc-business/src/main/java/com/zc/business/controller/WordController.java
  4. 6
      zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java
  5. 136
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

18
zc-business/src/main/java/com/zc/business/controller/DcBoardReleaseLogController.java

@ -1,8 +1,11 @@
package com.zc.business.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -62,6 +65,21 @@ public class DcBoardReleaseLogController extends BaseController
public void export(HttpServletResponse response, DcBoardReleaseLog dcBoardReleaseLog)
{
List<DcBoardReleaseLog> list = dcBoardReleaseLogService.selectDcBoardReleaseLogList(dcBoardReleaseLog);
for (DcBoardReleaseLog releaseLog : list) {
String content = releaseLog.getReleaseContent();
List<Map<String,Object>> contentList = JSONArray.parseObject(content,List.class);
if (contentList != null){
StringBuilder contentText = new StringBuilder();
for (int i = 0; i < contentList.size(); i++) {
String contentItem = contentList.get(i+1).get("CONTENT").toString().replace("\\\\n"," ");
contentText.append(i).append(".").append(contentItem).append("\n");
}
releaseLog.setReleaseContent(contentText.toString());
} else {
releaseLog.setReleaseContent("");
}
}
ExcelUtil<DcBoardReleaseLog> util = new ExcelUtil<>(DcBoardReleaseLog.class);
util.exportExcel(response, list, "情报板内容发布日志数据");
}

16
zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

@ -31,6 +31,7 @@ import javax.validation.Valid;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
/**
* 设备Controller
@ -240,17 +241,26 @@ public class DcDeviceController extends BaseController {
Object data = JSON.parseObject(queryDeviceProperties(deviceId, propertyId, props).get("data").toString()).get("data");
JSONArray dataArray = JSON.parseArray(data.toString());
List<Object> list = new ArrayList<>();
List<Map<String, Object>> list = new ArrayList<>();
dataArray.forEach(o -> {
Map<String, Object> map = new HashMap<>();
JSONObject jsonObject = JSON.parseObject(o.toString());
JSONObject formatValue = JSON.parseObject(jsonObject.get("formatValue").toString());
map.put("1", formatValue.get("1"));
map.put("3", formatValue.get("3"));
map.put("timestamp", jsonObject.get("timestamp"));
map.put("timestamp", formatValue.get("equipmentReportingTime") == null? "":formatValue.get("equipmentReportingTime"));
list.add(map);
});
return AjaxResult.success(list);
List<Map<String, Object>> newList = list.stream()
.filter(map-> !map.get("timestamp").equals(""))
.collect(Collectors.toList());
Collections.sort(newList, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> map1, Map<String, Object> map2) {
return map1.get("timestamp").toString().compareTo(map2.get("timestamp").toString());
}
});
return AjaxResult.success(newList);
}
/**

123
zc-business/src/main/java/com/zc/business/controller/WordController.java

@ -128,68 +128,75 @@ public class WordController {
PoiUtil.createHeading2(doc,"天气情况统计");
XWPFTable table = doc.createTable(9, 25);
//列宽自动分割
CTTblWidth infoTableWidth = table.getCTTbl().addNewTblPr().addNewTblW();
infoTableWidth.setType(STTblWidth.DXA);
infoTableWidth.setW(BigInteger.valueOf(9072));
AjaxResult ajaxResult = weatherForecastController.hourlyWeather();
if (ajaxResult.get("code").equals(200)) {
Map<String,List<Map<String,Object>>> data = (Map<String, List<Map<String,Object>>>) ajaxResult.get("data");
data.keySet().forEach(key ->{
if ("hourlyWeather1".equals(key)){
setTableFonts(table.getRow(1).getCell(0), "长清区");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
OffsetDateTime offsetDateTime = OffsetDateTime.parse(weatherList.get(i).get("fxTime").toString());
setTableFonts(table.getRow(0).getCell(i+1),offsetDateTime.format(DateTimeFormatter.ofPattern("dd日HH时")));
setTableFonts(table.getRow(1).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather2".equals(key)){
setTableFonts(table.getRow(2).getCell(0), "平阴县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(2).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather3".equals(key)){
setTableFonts(table.getRow(3).getCell(0), "东平县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(3).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather4".equals(key)){
setTableFonts(table.getRow(4).getCell(0), "汶上县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(4).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather5".equals(key)){
setTableFonts(table.getRow(5).getCell(0), "梁山县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(5).getCell(i+1), weatherList.get(i).get("text").toString());
if (data != null && data.size() != 0){
XWPFTable table = doc.createTable(9, 25);
//列宽自动分割
CTTblWidth infoTableWidth = table.getCTTbl().addNewTblPr().addNewTblW();
infoTableWidth.setType(STTblWidth.DXA);
infoTableWidth.setW(BigInteger.valueOf(9072));
data.keySet().forEach(key ->{
if ("hourlyWeather1".equals(key)){
setTableFonts(table.getRow(1).getCell(0), "长清区");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
OffsetDateTime offsetDateTime = OffsetDateTime.parse(weatherList.get(i).get("fxTime").toString());
setTableFonts(table.getRow(0).getCell(i+1),offsetDateTime.format(DateTimeFormatter.ofPattern("dd日HH时")));
setTableFonts(table.getRow(1).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather2".equals(key)){
setTableFonts(table.getRow(2).getCell(0), "平阴县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(2).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather3".equals(key)){
setTableFonts(table.getRow(3).getCell(0), "东平县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(3).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather4".equals(key)){
setTableFonts(table.getRow(4).getCell(0), "汶上县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(4).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather5".equals(key)){
setTableFonts(table.getRow(5).getCell(0), "梁山县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(5).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather6".equals(key)){
setTableFonts(table.getRow(6).getCell(0), "嘉祥县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(6).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather7".equals(key)){
setTableFonts(table.getRow(7).getCell(0), "巨野县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(7).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather8".equals(key)){
setTableFonts(table.getRow(8).getCell(0), "郓城县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(8).getCell(i+1), weatherList.get(i).get("text").toString());
}
}
} else if ("hourlyWeather6".equals(key)){
setTableFonts(table.getRow(6).getCell(0), "嘉祥县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(6).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather7".equals(key)){
setTableFonts(table.getRow(7).getCell(0), "巨野县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(7).getCell(i+1), weatherList.get(i).get("text").toString());
}
} else if ("hourlyWeather8".equals(key)){
setTableFonts(table.getRow(8).getCell(0), "郓城县");
List<Map<String,Object>> weatherList = data.get(key);
for (int i = 0; i < weatherList.size(); i++) {
setTableFonts(table.getRow(8).getCell(i+1), weatherList.get(i).get("text").toString());
}
}
});
});
} else {
addDescription(doc,"暂无数据");
}
}
//换行

6
zc-business/src/main/java/com/zc/business/domain/DcBoardReleaseLog.java

@ -40,7 +40,7 @@ public class DcBoardReleaseLog extends BaseEntity
private String stakeMark;
/** 方向1-上行,2-中,3-下行 */
@Excel(name = "方向1-上行,2-中,3-下行")
@Excel(name = "方向",readConverterExp = "1=上行,2=中,3=下行")
@ApiModelProperty(value="方向1-上行,2-中,3-下行")
private String direction;
@ -50,7 +50,7 @@ public class DcBoardReleaseLog extends BaseEntity
private String releaseContent;
/** 发布状态(0:成功;1:失败) */
@Excel(name = "发布状态", readConverterExp = "0=:成功;1:失败")
@Excel(name = "发布状态", readConverterExp = "0=成功,1失败")
@ApiModelProperty(value="发布状态0=:成功;1:失败")
private String releaseStatus;
@ -81,7 +81,7 @@ public class DcBoardReleaseLog extends BaseEntity
private String releaseUserId;
/** 发布端 */
@Excel(name = "发布端")
@Excel(name = "发布端", readConverterExp = "00=系统用户,01=智慧大脑,02=GIS+BIM")
@ApiModelProperty(value="发布端(00=系统用户,01=智慧大脑,02=GIS+BIM")
private String platform;

136
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -117,12 +117,8 @@ public class DcWarningServiceImpl implements IDcWarningService
String key=dcWarning.getStakeMark()+dcWarning.getDirection()+dcWarning.getWarningSource().
toString()+dcWarning.getWarningType().toString()+dcWarning.getWarningSubclass();//key,redis存储事件的key(桩号+方向+事件源+类型)
String dataId = redisCache.getCacheObject(WARNINGDATA + key);//查看redis是否存在数据(id的值)
HashMap redisValueOne = redisWarningStrategy.get(redisKye+"1");//查看传入的事件类型是否配置策略1(优先级策略)
if(redisValueOne!=null){//执行策略1(暂时未定义,定义后开发)
return dcWarningMapper.insertDcWarning(dcWarning);//未定义直接走新增;
}
HashMap redisValueTwo = redisWarningStrategy.get(redisKye+"2");//查看传入的事件类型是否配置策略2(延迟策略)
if (redisValueOne==null&&redisValueTwo!=null){ //执行策略2,执行到这里说明1不存在或者1未满足过滤条件
if (redisValueTwo!=null){ //执行策略2,
String strategyTime = redisValueTwo.get("strategyTime").toString();//策略时长
if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间
int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库
@ -147,85 +143,27 @@ public class DcWarningServiceImpl implements IDcWarningService
otherConfig = map.get("otherConfig").toString(); //取出原id的配置信息
}
String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息
JSONObject jsonObjectOne = new JSONObject(otherConfig);
JSONObject jsonObjectTwo = new JSONObject(otherConfigString);
DcWarningServiceImpl dcWarningService = new DcWarningServiceImpl();//合成新的json
JSONObject jsonObject = dcWarningService.mergeJsonObjects(jsonObjectOne, jsonObjectTwo);
Integer integer = dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置
redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间
if (integer==0){
return 0;
}
return 1;
}
HashMap redisValueThree = redisWarningStrategy.get(redisKye+"3");//查看传入的事件类型是否配置策略3(时间窗口策略)
if (redisValueOne==null&&redisValueTwo==null&&redisValueThree!=null){ //执行策略3,执行到这里说明1不存在或者2不存在或者1未满足过滤条件
String strategyTime = redisValueThree.get("strategyTime").toString();//策略时长
if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间
int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库
if (insertDcWarning==0){
return 0;
}
String id = dcWarning.getId();//取出加入后的id作为value
redisCache.setCacheObject(WARNINGDATA+key,id,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//加入缓存并设置延迟时间(单位分钟)
return 1;//结束
}
//redis存在数据,取出redis的id找对对应事件的配置,合成事件配置
HashMap<String, Object> map = dcWarningMapper.selectDcWarningById(dataId);
if (map==null){//redis中有id但是数据库中没有这条数据,那就删除这条redis数据,新数据加入到数据库,并加入到redis
redisCache.deleteObject(WARNINGDATA+key);
dcWarningMapper.insertDcWarning(dcWarning);
String id = dcWarning.getId();
redisCache.setCacheObject(WARNINGDATA+key,id,Integer.parseInt(strategyTime),TimeUnit.MINUTES);
return 1;
}
String otherConfig="";
otherConfig = map.get("otherConfig").toString();//取出原id的配置信息
String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息
JSONObject jsonObjectOne = new JSONObject(otherConfig);
JSONObject jsonObjectOne = new JSONObject(otherConfig);//原始数据库数据
JSONObject jsonObjectTwo = new JSONObject(otherConfigString);
JSONObject jsonObject = new DcWarningServiceImpl().mergeJsonObjects(jsonObjectOne, jsonObjectTwo);//合成新的json
Integer integer = dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置
if (integer==0){
return 0;
}
return 1;
}
HashMap redisValueFour = redisWarningStrategy.get(redisKye+"4");//查看传入的事件类型是否配置策略3(自动结束策略)
if (redisValueOne==null&&redisValueTwo==null&&redisValueThree==null&&redisValueFour!=null){ //执行策略4,执行到这里说明1不存在或者2、3不存在或者1未满足过滤条件
if (dataId==null){//如果不存在直接加入数据库,加入缓存
int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库
if (insertDcWarning==0){
return 0;
int videoListLength = jsonObjectOne.getJSONArray("videoList").length();//已经存在数据库的图片的长度
if (videoListLength>=10&&jsonObjectTwo.get("videoList")!=null){//如果数据长度大于等于10,对第十位进行替换
JSONArray videoList = jsonObjectOne.getJSONArray("videoList");//获取图片数组
videoList.put(9,jsonObjectTwo.get("videoList")); //替换第十个元素
jsonObjectOne.put("videoList", videoList);//更新 jsonObjectOne 中的 videoList 数组
if (jsonObjectOne.getJSONArray("pictures").length()>=10&&jsonObjectTwo.get("pictures")!=null){
JSONArray pictures = jsonObjectOne.getJSONArray("pictures");
pictures.put(9,jsonObjectTwo.get("pictures"));
jsonObjectOne.put("pictures",pictures);
}
String id = dcWarning.getId();//取出加入后的id作为value
redisCache.setCacheObject(WARNINGDATA+key,id,24,TimeUnit.HOURS);//加入缓存,防止redis数据累计,这里也要设置过期时间,设置为24小时
return 1;//结束
}
//redis存在数据,取出redis的id找对对应事件的配置,合成事件配置
HashMap<String, Object> map = dcWarningMapper.selectDcWarningById(dataId);
if (map==null){//redis中有id但是数据库中没有这条数据,那就删除这条redis数据,新数据加入到数据库,并加入到redis
redisCache.deleteObject(WARNINGDATA+key);
dcWarningMapper.insertDcWarning(dcWarning);
String id = dcWarning.getId();
redisCache.setCacheObject(WARNINGDATA+key,id);
return 1;
}
String otherConfig="";
otherConfig = map.get("otherConfig").toString();//取出原id的配置信息
String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息
JSONObject jsonObjectOne = new JSONObject(otherConfig);
JSONObject jsonObjectTwo = new JSONObject(otherConfigString);
JSONObject jsonObject = new DcWarningServiceImpl().mergeJsonObjects(jsonObjectOne, jsonObjectTwo);//合成新的json
Integer integer = dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置
redisCache.deleteObject(WARNINGDATA + key);//删除redis存储的数据
if (integer==0){
return 0;
redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间
return dcWarningMapper.updateOtherConfig(dataId,jsonObjectOne.toString());//修改数据库配置
}
return 1;
DcWarningServiceImpl dcWarningService = new DcWarningServiceImpl();//合成工具类
JSONObject jsonObject = dcWarningService.mergeJsonObjects(jsonObjectOne, jsonObjectTwo);
redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间
return dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置
}
return dcWarningMapper.insertDcWarning(dcWarning);//如果没有配置策略直接加入数据库;
}
//优先级策略(还差优先级策略需要配置)
@ -260,10 +198,40 @@ public class DcWarningServiceImpl implements IDcWarningService
String dataId = redisCache.getCacheObject(WARNINGDATA + key);//查看redis是否存在数据(id的值)
HashMap redisValueOne = redisWarningStrategy.get(redisKye+"1");//查看传入的事件类型是否配置策略1(优先级策略)
if(redisValueOne!=null){//执行策略1(暂时未定义,定义后开发)
String priority = redisValueOne.get("priority").toString();//全部的优先等级
String[] split = priority.split(",");
for (int i = 0; i < split.length; i++){
String priorityValue=split[i];//取出当前循环的优先级类型
String keys=dcWarning.getStakeMark()+dcWarning.getDirection()+dcWarning.getWarningSource().
toString()+dcWarning.getWarningType().toString()+priorityValue;//redis存储事件的key
String dataIds = redisCache.getCacheObject(WARNINGDATA + keys);//查看redis是否存在数据(id的值)
if (dataIds==null){ //没有对应的优先级类型的id值,结束当前循环
continue;
}
//redis存在数据,取出redis的id找对对应事件的配置,合成事件配置
HashMap<String, Object> map = dcWarningMapper.selectDcWarningById(dataId);
if (map==null){//redis中有id但是数据库中没有这条数据,那就直接新增这个事件
return dcWarningMapper.insertDcWarning(dcWarning);
}
String warningState = map.get("warningState").toString();//事件上报状态
if ("1".equals(warningState)==false){ //状态不为上报,不用合成事件,删除之前的redis数据
redisCache.deleteObject(WARNINGDATA+keys);
continue;
}
String otherConfig="";
if (map.get("otherConfig")!=null){
otherConfig = map.get("otherConfig").toString(); //取出原id的配置信息
}
String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息
JSONObject jsonObjectOne = new JSONObject(otherConfig);
JSONObject jsonObjectTwo = new JSONObject(otherConfigString);
DcWarningServiceImpl dcWarningService = new DcWarningServiceImpl();//合成新的json
JSONObject jsonObject = dcWarningService.mergeJsonObjects(jsonObjectOne, jsonObjectTwo);
return dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置
}
}
HashMap redisValueTwo = redisWarningStrategy.get(redisKye+"2");//查看传入的事件类型是否配置策略2(延迟策略)
if (redisValueOne==null&&redisValueTwo!=null){ //执行策略2,执行到这里说明1不存在或者1未满足过滤条件
if (redisValueTwo!=null){ //执行策略2,执行到这里说明1不存在或者1未满足过滤条件
String strategyTime = redisValueTwo.get("strategyTime").toString();//策略时长
if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间
int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库
@ -300,7 +268,7 @@ public class DcWarningServiceImpl implements IDcWarningService
return 1;
}
HashMap redisValueThree = redisWarningStrategy.get(redisKye+"3");//查看传入的事件类型是否配置策略3(时间窗口策略)
if (redisValueOne==null&&redisValueTwo==null&&redisValueThree!=null){ //执行策略3,执行到这里说明1不存在或者2不存在或者1未满足过滤条件
if (redisValueTwo==null&&redisValueThree!=null){ //执行策略3,执行到这里说明1不存在或者2不存在或者1未满足过滤条件
String strategyTime = redisValueThree.get("strategyTime").toString();//策略时长
if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间
int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库
@ -333,14 +301,14 @@ public class DcWarningServiceImpl implements IDcWarningService
return 1;
}
HashMap redisValueFour = redisWarningStrategy.get(redisKye+"4");//查看传入的事件类型是否配置策略3(自动结束策略)
if (redisValueOne==null&&redisValueTwo==null&&redisValueThree==null&&redisValueFour!=null){ //执行策略4,执行到这里说明1不存在或者2、3不存在或者1未满足过滤条件
if (redisValueTwo==null&&redisValueThree==null&&redisValueFour!=null){ //执行策略4,执行到这里说明1不存在或者2、3不存在或者1未满足过滤条件
if (dataId==null){//如果不存在直接加入数据库,加入缓存
int insertDcWarning = dcWarningMapper.insertDcWarning(dcWarning);//加入数据库
if (insertDcWarning==0){
return 0;
}
String id = dcWarning.getId();//取出加入后的id作为value
redisCache.setCacheObject(WARNINGDATA+key,id);//加入缓存????存在问题会数据累计
redisCache.setCacheObject(WARNINGDATA+key,id,24,TimeUnit.HOURS);//加入缓存,防止redis数据累计,这里也要设置过期时间,设置为24小时
return 1;//结束
}
//redis存在数据,取出redis的id找对对应事件的配置,合成事件配置

Loading…
Cancel
Save