|
@@ -103,33 +103,36 @@ public class ImGroupController extends BaseController {
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setTime(currentDate);
|
|
|
|
|
|
- // 将日期减少一个月
|
|
|
- calendar.add(Calendar.MONTH, -1);
|
|
|
+ // 将日期减少一天
|
|
|
+ calendar.add(Calendar.DATE, -1);
|
|
|
|
|
|
- // 获取减少一个月后的日期
|
|
|
- Date lastMonthDate = calendar.getTime();
|
|
|
+ // 获取减少一天后的日期
|
|
|
+ Date tommorow = calendar.getTime();
|
|
|
|
|
|
calendar.setTime(currentDate);
|
|
|
|
|
|
//按照小时递减
|
|
|
- while (currentDate.after(lastMonthDate))
|
|
|
+ while (currentDate.after(tommorow))
|
|
|
{
|
|
|
String d = DateUtil.format(DateUtil.addHours(currentDate,0), DateUtil.YEAR_MONTH_DAY_HOUR);
|
|
|
Object o = imGroupService.historyGet(d);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(o));
|
|
|
if(jsonObject.get("code").equals(200)){
|
|
|
- Boolean success = redisCache.getRedisTemplate().opsForValue().setIfAbsent("syncImHistoryMessage" + d,d);
|
|
|
+ /*Boolean success = redisCache.getRedisTemplate().opsForValue().setIfAbsent("syncImHistoryMessage" + d,d);
|
|
|
if(!success){
|
|
|
return;
|
|
|
- }
|
|
|
+ }*/
|
|
|
String url = jsonObject.getString("url");
|
|
|
- if(StringUtils.isEmpty(url)){
|
|
|
+ /*if(StringUtils.isEmpty(url)){
|
|
|
return;
|
|
|
+ }*/
|
|
|
+ if (!StringUtils.isEmpty(url)){
|
|
|
+ File file = new File(FileUtils.getTempDirectoryPath() + url.substring(url.lastIndexOf("/")));
|
|
|
+ URL url1 = new URL(url);
|
|
|
+ FileUtils.copyURLToFile(url1,file);
|
|
|
+ imGroupService.saveImHistoryMessage(new File(file.getAbsolutePath()));
|
|
|
}
|
|
|
- File file = new File(FileUtils.getTempDirectoryPath() + url.substring(url.lastIndexOf("/")));
|
|
|
- URL url1 = new URL(url);
|
|
|
- FileUtils.copyURLToFile(url1,file);
|
|
|
- imGroupService.saveImHistoryMessage(new File(file.getAbsolutePath()));
|
|
|
+
|
|
|
}
|
|
|
calendar.add(Calendar.HOUR,-1);
|
|
|
currentDate = calendar.getTime();
|