Commit 069b2ebd authored by tangwei's avatar tangwei

修改缓存

parent f2a8b77f
...@@ -508,16 +508,19 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -508,16 +508,19 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
relationRedisUtil.delSysRedisKey(fireFightSysIdsBuffer.toString()); relationRedisUtil.delSysRedisKey(fireFightSysIdsBuffer.toString());
} }
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { if (redisUtils.hasKey("equipAndCarIotCodes")) {
@Override redisUtils.del("equipAndCarIotCodes");
public void afterCommit() { }
List<EquipmentSpecificVo> data = equipmentSpecificMapper.getEquipOrCarByIotCode(null); // TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
if (redisUtils.hasKey("equipAndCarIotCodes")) { // @Override
redisUtils.del("equipAndCarIotCodes"); // public void afterCommit() {
} // List<EquipmentSpecificVo> data = equipmentSpecificMapper.getEquipOrCarByIotCode(null);
redisUtils.set("equipAndCarIotCodes", JSONObject.toJSONString(data)); // if (redisUtils.hasKey("equipAndCarIotCodes")) {
} // redisUtils.del("equipAndCarIotCodes");
}); // }
// redisUtils.set("equipAndCarIotCodes", JSONObject.toJSONString(data));
// }
// });
} catch (Exception e) { } catch (Exception e) {
//处理异常 返回 成功失败条数 //处理异常 返回 成功失败条数
...@@ -528,7 +531,14 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -528,7 +531,14 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
return date; return date;
} }
String[] split = errBufferName.toString().split(","); String[] split = errBufferName.toString().split(",");
String date="上传成功:"+(equipmentDetailDownloadVOS.size()-(split!=null?split.length:0))+"条---上传失败:"+(split!=null?split.length:0)+"条(失败编号:"+errBufferName+"详情:"+erryy+")"; String date="";
if(split!=null&&split.length>0&&!"".equals(split[0])){
date="上传成功:"+(equipmentDetailDownloadVOS.size()-(split!=null?split.length:0))+"条---上传失败:"+(split!=null?split.length:0)+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
}else{
date="上传成功:"+(equipmentDetailDownloadVOS.size())+"条---上传失败:"+"0条(失败编号:"+errBufferName+"详情:"+erryy+")";
}
log.error(date); log.error(date);
return date; return date;
} }
......
...@@ -44,7 +44,9 @@ public class RelationRedisUtil { ...@@ -44,7 +44,9 @@ public class RelationRedisUtil {
List<String> collect = list.stream().map(FireFightingSystemEntity::getSystemTypeCode).collect(Collectors.toList()); List<String> collect = list.stream().map(FireFightingSystemEntity::getSystemTypeCode).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) { if (CollectionUtils.isNotEmpty(collect)) {
for (String key : collect) { for (String key : collect) {
redisUtil.del(key); if (key!=null&&redisUtil.hasKey(key)){
redisUtil.del(key);
}
} }
return Boolean.TRUE; return Boolean.TRUE;
} }
......
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