|
|
@ -145,15 +145,15 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
|
String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息
|
|
|
|
JSONObject jsonObjectOne = new JSONObject(otherConfig);//原始数据库数据
|
|
|
|
JSONObject jsonObjectTwo = new JSONObject(otherConfigString); |
|
|
|
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); |
|
|
|
int picturesLength = jsonObjectOne.getJSONArray("pictures").length();//已经存在数据库的图片的长度
|
|
|
|
if (picturesLength>=10&&jsonObjectTwo.get("pictures")!=null){//如果数据长度大于等于10,对第十位进行替换
|
|
|
|
JSONArray pictures = jsonObjectOne.getJSONArray("pictures");//获取图片数组
|
|
|
|
pictures.put(9,jsonObjectTwo.getJSONArray("pictures").getString(0)); //替换第十个元素
|
|
|
|
jsonObjectOne.put("pictures", pictures);//更新 jsonObjectOne中的pictures 数组
|
|
|
|
if (jsonObjectOne.getJSONArray("videoList").length()>=10&&jsonObjectTwo.get("videoList")!=null){ |
|
|
|
JSONArray videoList = jsonObjectOne.getJSONArray("videoList"); |
|
|
|
videoList.put(9,jsonObjectTwo.getJSONArray("videoList").getString(0)); |
|
|
|
jsonObjectOne.put("videoList",videoList); |
|
|
|
} |
|
|
|
redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间
|
|
|
|
return dcWarningMapper.updateOtherConfig(dataId,jsonObjectOne.toString());//修改数据库配置
|
|
|
|