Commit f1937228 authored by 张君's avatar 张君

回退

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