Browse Source

1.解决抖音挑战赛活动时间到了还在统计数据问题
2.查询医师无法查询到修改的数据

JiangChongBo 2 năm trước cách đây
mục cha
commit
31d872a71c

+ 19 - 10
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -1804,22 +1804,31 @@ public class AuthServiceImpl implements AuthService {
 //        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();
-        //根据item_id更新视频数据(点赞量,播放量)
-        for (ChallengeRoundVo chall:roundlist) {
-            String data = 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 = 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());
+                    }
+                }
             }
         }
         return ResponseJson.success();

+ 22 - 10
src/main/java/com/caimei/task/DyInfoTask.java

@@ -6,6 +6,7 @@ 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;
@@ -21,6 +22,8 @@ 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
@@ -46,22 +49,31 @@ public class DyInfoTask {
 //        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();
-        //根据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());
+                    }
+                }
             }
         }
     }

+ 1 - 1
src/main/resources/mapper/AuthMapper.xml

@@ -798,7 +798,7 @@
         where cr.userName=#{userName}
     </select>
     <select id="getRoundlist" resultType="com.caimei.model.vo.ChallengeRoundVo">
-        select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId, cr.authId,cr.dyCommand,cr.diggCount,cr.playCount
+        select cr.id,cr.userName,cr.authUserId,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId, cr.authId,cr.dyCommand,cr.diggCount,cr.playCount
         from cm_challenge_round cr
     </select>
     <update id="upVidoInfoById">

+ 1 - 0
src/main/resources/mapper/LogisticsMapper.xml

@@ -12,6 +12,7 @@
                state, info, remarksImage, li.remarks, updateDate
                from logistics_information li left join cm_brand_auth a on li.authId = a.id and a.delFlag = 0
         where a.id = #{authId}
+        order by updateDate desc
     </select>
     <select id="getLogisticsCompanyList" resultType="com.caimei.model.vo.LogisticsCompanyVo">
         select id, label as companyName, value as companyCode