Commit f1937228 authored by 张君's avatar 张君

回退

parent a654bd7e
...@@ -67,15 +67,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -67,15 +67,7 @@ public class BLessonServiceImpl implements BLessonService {
@Override @Override
public List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, BLesson model) { public List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, BLesson model) {
List<BLesson> bLessons = bLessonRepository.queryBLessons(model); return bLessonRepository.queryBLessons(model);
for (BLesson blesson : bLessons){
if (!"/default/course.jpg".equals(blesson.getDefaultUrl())){
String a = global.getBASE_UPLOAD_SERVER_LOCATION()+blesson.getDefaultUrl();
blesson.setDefaultUrl(convertFileToBase64(a));
// "D:\\eduServer\\upload\\course\\logo47c32bf0-cc16-420b-9030-cf97471401dc.jpg"
}
}
return bLessons;
} }
@Override @Override
......
...@@ -21,6 +21,7 @@ public interface RcRedisService { ...@@ -21,6 +21,7 @@ public interface RcRedisService {
*/ */
public void returnResource(Jedis jedis); public void returnResource(Jedis jedis);
public void returnBrokenResource(Jedis jedis);
/** /**
* 赋值 * 赋值
* @param key * @param key
......
...@@ -21,6 +21,8 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -21,6 +21,8 @@ public class RcRedisServiceImpl implements RcRedisService {
@Override @Override
public Jedis getResource() { public Jedis getResource() {
log.info("++++"+jedisPool+"---");
log.info("++++"+jedisPool.getResource()+"---");
return jedisPool.getResource(); return jedisPool.getResource();
} }
...@@ -32,6 +34,17 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -32,6 +34,17 @@ public class RcRedisServiceImpl implements RcRedisService {
} }
} }
// 出现异常释放资源
@Override
public synchronized void returnBrokenResource(Jedis jedis) {
if (jedis != null) {
jedisPool.returnBrokenResource(jedis);
}
}
@Override @Override
public void set(String key, String value,int expire) { public void set(String key, String value,int expire) {
Jedis jedis=null; Jedis jedis=null;
...@@ -42,6 +55,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -42,6 +55,7 @@ public class RcRedisServiceImpl implements RcRedisService {
jedis.expire(key,expire); jedis.expire(key,expire);
log.info("Redis set success - " + key + ", value:" + value); log.info("Redis set success - " + key + ", value:" + value);
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value); log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value);
}finally{ }finally{
...@@ -57,6 +71,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -57,6 +71,7 @@ public class RcRedisServiceImpl implements RcRedisService {
jedis.set(key, value); jedis.set(key, value);
log.info("Redis set success - " + key + ", value:" + value); log.info("Redis set success - " + key + ", value:" + value);
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value); log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value);
}finally{ }finally{
...@@ -72,6 +87,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -72,6 +87,7 @@ public class RcRedisServiceImpl implements RcRedisService {
jedis.set(key.getBytes(), value); jedis.set(key.getBytes(), value);
log.info("Redis set success - " + key + ", value:" + value); log.info("Redis set success - " + key + ", value:" + value);
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value); log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value);
}finally{ }finally{
...@@ -89,6 +105,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -89,6 +105,7 @@ public class RcRedisServiceImpl implements RcRedisService {
jedis.expire(key,expire); jedis.expire(key,expire);
log.info("Redis set success - " + key + ", value:" + value); log.info("Redis set success - " + key + ", value:" + value);
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value); log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value);
}finally{ }finally{
...@@ -104,6 +121,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -104,6 +121,7 @@ public class RcRedisServiceImpl implements RcRedisService {
result = jedis.get(key); result = jedis.get(key);
log.info("Redis get success - " + key + ", value:" + result); log.info("Redis get success - " + key + ", value:" + result);
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + result); log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + result);
}finally{ }finally{
...@@ -121,6 +139,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -121,6 +139,7 @@ public class RcRedisServiceImpl implements RcRedisService {
result = jedis.get(key.getBytes()); result = jedis.get(key.getBytes());
log.info("Redis get success - " + key + ", value:" + result); log.info("Redis get success - " + key + ", value:" + result);
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + result); log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + result);
}finally{ }finally{
...@@ -137,6 +156,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -137,6 +156,7 @@ public class RcRedisServiceImpl implements RcRedisService {
jedis.del(key); jedis.del(key);
log.info("Redis del success - " + key ); log.info("Redis del success - " + key );
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key ); log.error("Redis set error: "+ e.getMessage() +" - " + key );
}finally{ }finally{
...@@ -154,6 +174,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -154,6 +174,7 @@ public class RcRedisServiceImpl implements RcRedisService {
result = jedis.lrange(key, 0, -1); result = jedis.lrange(key, 0, -1);
log.info("Redis get list success - " + key + ", value:" + result); log.info("Redis get list success - " + key + ", value:" + result);
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key ); log.error("Redis set error: "+ e.getMessage() +" - " + key );
}finally{ }finally{
...@@ -172,6 +193,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -172,6 +193,7 @@ public class RcRedisServiceImpl implements RcRedisService {
jedis.rpush(key, value); jedis.rpush(key, value);
log.info("Redis set list success - " + key + ", value:" + value); log.info("Redis set list success - " + key + ", value:" + value);
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value); log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value);
}finally{ }finally{
...@@ -187,6 +209,7 @@ public class RcRedisServiceImpl implements RcRedisService { ...@@ -187,6 +209,7 @@ public class RcRedisServiceImpl implements RcRedisService {
jedis.lrem(key,1,value); jedis.lrem(key,1,value);
log.info("Redis remove list success - " + key + ", value:" + value); log.info("Redis remove list success - " + key + ", value:" + value);
} catch (Exception e) { } catch (Exception e) {
returnBrokenResource(jedis);
e.printStackTrace(); e.printStackTrace();
log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value); log.error("Redis set error: "+ e.getMessage() +" - " + key + ", value:" + value);
}finally{ }finally{
......
...@@ -32,13 +32,11 @@ public class UploadUtil { ...@@ -32,13 +32,11 @@ public class UploadUtil {
try { try {
UUID uuid = UUID.randomUUID(); UUID uuid = UUID.randomUUID();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
String userPath = uploadPath; String userPath = uploadPath +
// + File.separator+calendar.get(Calendar.YEAR)+
// File.separator+calendar.get(Calendar.YEAR)+ File.separator+calendar.get(Calendar.MONTH)+
// File.separator+calendar.get(Calendar.MONTH)+ File.separator+calendar.get(Calendar.DATE)+
// File.separator+calendar.get(Calendar.DATE)+ File.separator;
// File.separator
String realPath = basePath + File.separator+ userPath; String realPath = basePath + File.separator+ userPath;
//创建File对象,参数为String类型,表示目录名 //创建File对象,参数为String类型,表示目录名
File dir = new File(realPath); File dir = new File(realPath);
......
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