fix(watch): 上线修复BUG
This commit is contained in:
+10
-3
@@ -59,9 +59,16 @@ public class WatchCloudManager {
|
||||
if (CollectionUtil.isEmpty(userIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return ListUtil.partition(userIds, 500)
|
||||
.stream()
|
||||
.flatMap(subIds -> sysBaseApi.listUserByIdsNew(subIds).stream())
|
||||
List<List<String>> partitions = ListUtil.partition(userIds, 500);
|
||||
log.info("[userListNew] 开始批量查询用户,总数={},分批数={}", userIds.size(), partitions.size());
|
||||
return partitions.stream()
|
||||
.flatMap(subIds -> {
|
||||
log.info("[userListNew] 调用Feign,本批数量={}", subIds.size());
|
||||
long start = System.currentTimeMillis();
|
||||
List<LoginUser> result = sysBaseApi.listUserByIdsNew(subIds);
|
||||
log.info("[userListNew] Feign返回,本批耗时={}ms,返回数量={}", System.currentTimeMillis() - start, result == null ? 0 : result.size());
|
||||
return result == null ? java.util.stream.Stream.empty() : result.stream();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -193,7 +193,7 @@
|
||||
) where rn = 1)
|
||||
where userid = #{userid,jdbcType=VARCHAR}
|
||||
and watch_no = #{watchNo,jdbcType=VARCHAR}
|
||||
and "type" = 2;
|
||||
and type = 2;
|
||||
</update>
|
||||
|
||||
<insert id="insertStress">
|
||||
@@ -226,7 +226,7 @@
|
||||
) where rn = 1)
|
||||
where userid = #{userid,jdbcType=VARCHAR}
|
||||
and watch_no = #{watchNo,jdbcType=VARCHAR}
|
||||
and "type" = 3;
|
||||
and type = 3;
|
||||
</update>
|
||||
|
||||
<insert id="insertSleep">
|
||||
@@ -266,7 +266,7 @@
|
||||
) where ROWNUM = 1)
|
||||
where userid = #{userid,jdbcType=VARCHAR}
|
||||
and watch_no = #{watchNo,jdbcType=VARCHAR}
|
||||
and "type" = 4;
|
||||
and type = 4;
|
||||
</update>
|
||||
|
||||
<insert id="insertTemperature">
|
||||
@@ -299,7 +299,7 @@
|
||||
) where rn = 1)
|
||||
where userid = #{userid,jdbcType=VARCHAR}
|
||||
and watch_no = #{watchNo,jdbcType=VARCHAR}
|
||||
and "type" = 5;
|
||||
and type = 5;
|
||||
</update>
|
||||
|
||||
<insert id="insertWorkout">
|
||||
@@ -335,7 +335,7 @@
|
||||
) where rn = 1)
|
||||
where userid = #{userid,jdbcType=VARCHAR}
|
||||
and watch_no = #{watchNo,jdbcType=VARCHAR}
|
||||
and "type" = 6;
|
||||
and type = 6;
|
||||
</update>
|
||||
|
||||
<insert id="insertDistance">
|
||||
@@ -371,7 +371,7 @@
|
||||
) where rn = 1)
|
||||
where userid = #{userid,jdbcType=VARCHAR}
|
||||
and watch_no = #{watchNo,jdbcType=VARCHAR}
|
||||
and "type" = 7;
|
||||
and type = 7;
|
||||
</update>
|
||||
|
||||
<insert id="insertSteps">
|
||||
@@ -407,6 +407,6 @@
|
||||
) where rn = 1)
|
||||
where userid = #{userid,jdbcType=VARCHAR}
|
||||
and watch_no = #{watchNo,jdbcType=VARCHAR}
|
||||
and "type" = 8;
|
||||
and type = 8;
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
+14
-1
@@ -12,6 +12,7 @@ import com.renkang.watch.mapper.*;
|
||||
import com.renkang.watch.service.IWatchUserDataService;
|
||||
import com.renkang.watch.util.WatchDataType;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.global.GlobalUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -28,6 +29,7 @@ import java.util.stream.Collectors;
|
||||
* @author Jiang Shunzhi
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class PostProcessor implements IPostProcessor {
|
||||
|
||||
private static WatchDataMapper watchDataMapperStatic;
|
||||
@@ -123,14 +125,25 @@ public class PostProcessor implements IPostProcessor {
|
||||
.stream()
|
||||
.flatMap(map -> map.values().stream())
|
||||
.collect(Collectors.toList());
|
||||
log.info("[getUserMap] 准备查询用户信息,userIds数量={}", userIds.size());
|
||||
GlobalUtils.setFeignToken();
|
||||
return cloudManager.userMapNew(userIds);
|
||||
log.info("[getUserMap] setFeignToken完成,开始调用Feign");
|
||||
long start = System.currentTimeMillis();
|
||||
try {
|
||||
Map<String, LoginUser> userMap = cloudManager.userMapNew(userIds);
|
||||
log.info("[getUserMap] Feign调用成功,耗时={}ms,返回用户数={}", System.currentTimeMillis() - start, userMap.size());
|
||||
return userMap;
|
||||
} catch (Exception e) {
|
||||
log.error("[getUserMap] Feign调用失败,耗时={}ms,userIds数量={}", System.currentTimeMillis() - start, userIds.size(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void statCommon(Map<String, Map<Date, String>> userBindWatch,
|
||||
BiConsumer<LoginUser, String> updateLatest,
|
||||
BiConsumer<LoginUser, Date> updateStat) {
|
||||
Map<String, LoginUser> userMap = getUserMap(userBindWatch);
|
||||
log.info("[statCommon] userMap获取完成,共{}个用户,watchNo数量={}", userMap.size(), userBindWatch.size());
|
||||
for (Map.Entry<String, Map<Date, String>> entry : userBindWatch.entrySet()) {
|
||||
entry.getValue().values().stream().distinct().forEach(userId -> {
|
||||
LoginUser userInfo = userMap.get(userId);
|
||||
|
||||
Reference in New Issue
Block a user