Commit fe99f435 by sunxiwang

统计修改

1 parent 13b5b58b
...@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom; ...@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.redis.RedisCache; import com.linkwechat.common.core.redis.RedisCache;
import com.linkwechat.wecom.domain.dto.WePageStaticDataDto;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
import com.linkwechat.wecom.service.IWeUserService; import com.linkwechat.wecom.service.IWeUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -42,6 +43,7 @@ public class WePageDateContraller { ...@@ -42,6 +43,7 @@ public class WePageDateContraller {
@PreAuthorize("@ss.hasPermi('wecom:page:getCorpRealTimeData')") @PreAuthorize("@ss.hasPermi('wecom:page:getCorpRealTimeData')")
@GetMapping("/getCorpRealTimeData") @GetMapping("/getCorpRealTimeData")
public AjaxResult getCorpRealTimeData(){ public AjaxResult getCorpRealTimeData(){
return AjaxResult.success(redisCache.getCacheList("getCorpRealTimeData")); WePageStaticDataDto wePageStaticDataDto = redisCache.getCacheObject("getCorpRealTimeData");
return AjaxResult.success(wePageStaticDataDto);
} }
} }
...@@ -371,8 +371,8 @@ public class WeConstans { ...@@ -371,8 +371,8 @@ public class WeConstans {
} }
public static final String WECOM_FINANCE_INDEX = "finance"; //public static final String WECOM_FINANCE_INDEX = "finance";
//public static final String WECOM_FINANCE_INDEX = "finance_new"; public static final String WECOM_FINANCE_INDEX = "finance_new";
public static final String WECOM_SENSITIVE_HIT_INDEX = "sensitive"; public static final String WECOM_SENSITIVE_HIT_INDEX = "sensitive";
......
package com.linkwechat.quartz.task; package com.linkwechat.quartz.task;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.utils.bean.BeanUtils; import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.client.WeCustomerClient; import com.linkwechat.wecom.client.WeCustomerClient;
...@@ -55,17 +56,22 @@ public class GroupChatStatisticTask { ...@@ -55,17 +56,22 @@ public class GroupChatStatisticTask {
idList.add(weGroup.getOwner()); idList.add(weGroup.getOwner());
ownerFilter.setUserid_list(idList); ownerFilter.setUserid_list(idList);
query.setOwnerFilter(ownerFilter); query.setOwnerFilter(ownerFilter);
GroupChatStatisticDto groupChatStatistic = weCustomerClient.getGroupChatStatisticGroupByDay(query); try {
List<GroupChatStatisticDto.GroupchatStatisticData> items = groupChatStatistic.getItems(); GroupChatStatisticDto groupChatStatistic = weCustomerClient.getGroupChatStatisticGroupByDay(query);
if(CollectionUtil.isNotEmpty(items)){ List<GroupChatStatisticDto.GroupchatStatisticData> items = groupChatStatistic.getItems();
items.forEach(groupchatStatisticData -> { if(CollectionUtil.isNotEmpty(items)){
WeGroupStatistic weGroupStatistic = new WeGroupStatistic(); items.forEach(groupchatStatisticData -> {
GroupChatStatisticDto.StatisticData data = groupchatStatisticData.getData(); WeGroupStatistic weGroupStatistic = new WeGroupStatistic();
BeanUtils.copyPropertiesignoreOther(data, weGroupStatistic); GroupChatStatisticDto.StatisticData data = groupchatStatisticData.getData();
weGroupStatistic.setChatId(weGroup.getChatId()); BeanUtils.copyPropertiesignoreOther(data, weGroupStatistic);
weGroupStatistic.setStatTime(groupchatStatisticData.getStatTime()); weGroupStatistic.setChatId(weGroup.getChatId());
weGroupStatisticList.add(weGroupStatistic); weGroupStatistic.setStatTime(groupchatStatisticData.getStatTime());
}); weGroupStatisticList.add(weGroupStatistic);
});
}
} catch (Exception e) {
e.printStackTrace();
log.error("群聊数据拉取失败: ownerFilter:【{}】,ex:【{}】", JSONObject.toJSONString(ownerFilter),e.getStackTrace());
} }
}); });
weGroupStatisticService.saveBatch(weGroupStatisticList); weGroupStatisticService.saveBatch(weGroupStatisticList);
......
...@@ -2,6 +2,7 @@ package com.linkwechat.quartz.task; ...@@ -2,6 +2,7 @@ package com.linkwechat.quartz.task;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dtflys.forest.exceptions.ForestRuntimeException;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.bean.BeanUtils; import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.client.WeCustomerClient; import com.linkwechat.wecom.client.WeCustomerClient;
...@@ -65,13 +66,18 @@ public class UserBehaviorDataTak { ...@@ -65,13 +66,18 @@ public class UserBehaviorDataTak {
List<String> idList = new ArrayList<>(); List<String> idList = new ArrayList<>();
idList.add(weUser.getUserId()); idList.add(weUser.getUserId());
query.setUserid(idList); query.setUserid(idList);
UserBehaviorDataDto userBehaviorData = weCustomerClient.getUserBehaviorData(query); try {
List<UserBehaviorDataDto.BehaviorData> behaviorDataList = userBehaviorData.getBehaviorData(); UserBehaviorDataDto userBehaviorData = weCustomerClient.getUserBehaviorData(query);
for (UserBehaviorDataDto.BehaviorData data : behaviorDataList) { List<UserBehaviorDataDto.BehaviorData> behaviorDataList = userBehaviorData.getBehaviorData();
WeUserBehaviorData weUserBehaviorData = new WeUserBehaviorData(); for (UserBehaviorDataDto.BehaviorData data : behaviorDataList) {
BeanUtils.copyPropertiesignoreOther(data, weUserBehaviorData); WeUserBehaviorData weUserBehaviorData = new WeUserBehaviorData();
weUserBehaviorData.setUserId(weUser.getUserId()); BeanUtils.copyPropertiesignoreOther(data, weUserBehaviorData);
dataList.add(weUserBehaviorData); weUserBehaviorData.setUserId(weUser.getUserId());
dataList.add(weUserBehaviorData);
}
} catch (ForestRuntimeException e) {
e.printStackTrace();
log.error("员工数据拉取失败: userId:【{}】,ex:【{}】",weUser.getUserId(),e.getStackTrace());
} }
}); });
weUserBehaviorDataService.saveBatch(dataList); weUserBehaviorDataService.saveBatch(dataList);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!