|
@@ -6,6 +6,7 @@ import com.caimei.annotation.CurrentUser;
|
|
import com.caimei.components.RedisService;
|
|
import com.caimei.components.RedisService;
|
|
import com.caimei.mapper.cmMapper.AuthMapper;
|
|
import com.caimei.mapper.cmMapper.AuthMapper;
|
|
import com.caimei.model.po.SysUser;
|
|
import com.caimei.model.po.SysUser;
|
|
|
|
+import com.caimei.model.vo.ChallengeActivityVo;
|
|
import com.caimei.model.vo.ChallengeRoundVo;
|
|
import com.caimei.model.vo.ChallengeRoundVo;
|
|
import com.caimei.model.vo.DyVideoInfoVo;
|
|
import com.caimei.model.vo.DyVideoInfoVo;
|
|
import com.caimei.model.vo.StatisticsVo;
|
|
import com.caimei.model.vo.StatisticsVo;
|
|
@@ -21,6 +22,8 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -46,22 +49,31 @@ public class DyInfoTask {
|
|
// Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
|
|
// Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
|
|
String dyopenId=null;
|
|
String dyopenId=null;
|
|
String DYaccessToken=null;
|
|
String DYaccessToken=null;
|
|
|
|
+ Date date=new Date();
|
|
|
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ String now = sf.format(date).replace("T", "");
|
|
if(redisService.getExpireTime("DyopenId")>0&&redisService.getExpireTime("DYaccessToken")>0){
|
|
if(redisService.getExpireTime("DyopenId")>0&&redisService.getExpireTime("DYaccessToken")>0){
|
|
dyopenId=redisService.get("DyopenId").toString();
|
|
dyopenId=redisService.get("DyopenId").toString();
|
|
DYaccessToken=redisService.get("DYaccessToken").toString();
|
|
DYaccessToken=redisService.get("DYaccessToken").toString();
|
|
}
|
|
}
|
|
//获取供应商下面所有机构发的视频
|
|
//获取供应商下面所有机构发的视频
|
|
List<ChallengeRoundVo> roundlist = authMapper.getRoundlist();
|
|
List<ChallengeRoundVo> roundlist = authMapper.getRoundlist();
|
|
- //根据item_id更新视频数据(点赞量,播放量)
|
|
|
|
- for (ChallengeRoundVo chall:roundlist) {
|
|
|
|
- String data = authServiceImpl.getVideoDataByItemId(dyopenId, DYaccessToken, chall.getItemId());
|
|
|
|
- JSONObject paramslist = JSONObject.parseObject(data);
|
|
|
|
- String resultList=paramslist.getString("list");
|
|
|
|
- List<DyVideoInfoVo> listDyVideoInfoVo= JSONArray.parseArray(resultList, DyVideoInfoVo.class);
|
|
|
|
- if(listDyVideoInfoVo!=null&&listDyVideoInfoVo.size()>0){
|
|
|
|
- StatisticsVo StatisticsVo= JSONObject.parseObject(listDyVideoInfoVo.get(0).getStatistics(), StatisticsVo.class);
|
|
|
|
- //更新视频数据到数据库
|
|
|
|
- authMapper.upVidoInfoById(chall.getId(),StatisticsVo.getDigg_count(),StatisticsVo.getPlay_count());
|
|
|
|
|
|
+ if(null !=roundlist && roundlist.size()>0){
|
|
|
|
+ //根据item_id更新视频数据(点赞量,播放量)
|
|
|
|
+ for (ChallengeRoundVo chall:roundlist) {
|
|
|
|
+ //如果当前时间大于活动结束时间则不再统计
|
|
|
|
+ ChallengeActivityVo activityTime = authMapper.getActivityTime(chall.getAuthUserId());
|
|
|
|
+ if(null !=activityTime && now.compareTo(activityTime.getEndTime())<0){
|
|
|
|
+ String data = authServiceImpl.getVideoDataByItemId(dyopenId, DYaccessToken, chall.getItemId());
|
|
|
|
+ JSONObject paramslist = JSONObject.parseObject(data);
|
|
|
|
+ String resultList=paramslist.getString("list");
|
|
|
|
+ List<DyVideoInfoVo> listDyVideoInfoVo= JSONArray.parseArray(resultList, DyVideoInfoVo.class);
|
|
|
|
+ if(listDyVideoInfoVo!=null&&listDyVideoInfoVo.size()>0){
|
|
|
|
+ StatisticsVo StatisticsVo= JSONObject.parseObject(listDyVideoInfoVo.get(0).getStatistics(), StatisticsVo.class);
|
|
|
|
+ //更新视频数据到数据库
|
|
|
|
+ authMapper.upVidoInfoById(chall.getId(),StatisticsVo.getDigg_count(),StatisticsVo.getPlay_count());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|