|
@@ -1,80 +1,80 @@
|
|
|
-package com.caimei.task;
|
|
|
+//package com.caimei.task;
|
|
|
+//
|
|
|
+//import com.alibaba.fastjson.JSONArray;
|
|
|
+//import com.alibaba.fastjson.JSONObject;
|
|
|
+//import com.caimei.annotation.CurrentUser;
|
|
|
+//import com.caimei.components.RedisService;
|
|
|
+//import com.caimei.mapper.cmMapper.AuthMapper;
|
|
|
+//import com.caimei.model.po.SysUser;
|
|
|
+//import com.caimei.model.vo.ChallengeActivityVo;
|
|
|
+//import com.caimei.model.vo.ChallengeRoundVo;
|
|
|
+//import com.caimei.model.vo.DyVideoInfoVo;
|
|
|
+//import com.caimei.model.vo.StatisticsVo;
|
|
|
+//import com.caimei.service.auth.impl.AuthServiceImpl;
|
|
|
+//import lombok.AllArgsConstructor;
|
|
|
+//import lombok.NoArgsConstructor;
|
|
|
+//import lombok.RequiredArgsConstructor;
|
|
|
+//import lombok.extern.slf4j.Slf4j;
|
|
|
+//import org.springframework.context.annotation.Configuration;
|
|
|
+//import org.springframework.scheduling.annotation.Async;
|
|
|
+//import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
+//import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+//import org.springframework.stereotype.Component;
|
|
|
+//
|
|
|
+//import javax.annotation.Resource;
|
|
|
+//import java.text.SimpleDateFormat;
|
|
|
+//import java.util.Date;
|
|
|
+//import java.util.List;
|
|
|
+//
|
|
|
+//@Slf4j
|
|
|
+//@Configuration
|
|
|
+//@EnableScheduling
|
|
|
+//@NoArgsConstructor
|
|
|
+//@AllArgsConstructor
|
|
|
+//public class DyInfoTask {
|
|
|
+// @Resource
|
|
|
+// private RedisService redisService;
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// private AuthMapper authMapper;
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// private AuthServiceImpl authServiceImpl;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.caimei.annotation.CurrentUser;
|
|
|
-import com.caimei.components.RedisService;
|
|
|
-import com.caimei.mapper.cmMapper.AuthMapper;
|
|
|
-import com.caimei.model.po.SysUser;
|
|
|
-import com.caimei.model.vo.ChallengeActivityVo;
|
|
|
-import com.caimei.model.vo.ChallengeRoundVo;
|
|
|
-import com.caimei.model.vo.DyVideoInfoVo;
|
|
|
-import com.caimei.model.vo.StatisticsVo;
|
|
|
-import com.caimei.service.auth.impl.AuthServiceImpl;
|
|
|
-import lombok.AllArgsConstructor;
|
|
|
-import lombok.NoArgsConstructor;
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.context.annotation.Configuration;
|
|
|
-import org.springframework.scheduling.annotation.Async;
|
|
|
-import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-@Slf4j
|
|
|
-@Configuration
|
|
|
-@EnableScheduling
|
|
|
-@NoArgsConstructor
|
|
|
-@AllArgsConstructor
|
|
|
-public class DyInfoTask {
|
|
|
- @Resource
|
|
|
- private RedisService redisService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- private AuthMapper authMapper;
|
|
|
-
|
|
|
- @Resource
|
|
|
- private AuthServiceImpl authServiceImpl;
|
|
|
-
|
|
|
- @Scheduled(cron = "0 0 2 * * ?")
|
|
|
- public void getDyVidoInfo(){
|
|
|
- log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>开始执行,ldmLatestClubId:" );
|
|
|
- // 获取供应商用户id
|
|
|
-// Integer userIdentity = sysUser.getUserIdentity();
|
|
|
-// Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
|
|
|
- String dyopenId=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){
|
|
|
- dyopenId=redisService.get("DyopenId").toString();
|
|
|
- DYaccessToken=redisService.get("DYaccessToken").toString();
|
|
|
- }
|
|
|
- //获取供应商下面所有机构发的视频
|
|
|
- List<ChallengeRoundVo> roundlist = authMapper.getRoundlist();
|
|
|
- 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());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+// @Scheduled(cron = "0 0 2 * * ?")
|
|
|
+// public void getDyVidoInfo(){
|
|
|
+// log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>开始执行,ldmLatestClubId:" );
|
|
|
+// // 获取供应商用户id
|
|
|
+//// Integer userIdentity = sysUser.getUserIdentity();
|
|
|
+//// Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
|
|
|
+// String dyopenId=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){
|
|
|
+// dyopenId=redisService.get("DyopenId").toString();
|
|
|
+// DYaccessToken=redisService.get("DYaccessToken").toString();
|
|
|
+// }
|
|
|
+// //获取供应商下面所有机构发的视频
|
|
|
+// List<ChallengeRoundVo> roundlist = authMapper.getRoundlist();
|
|
|
+// 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());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//}
|