diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/android/service/impl/UserServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/android/service/impl/UserServiceImpl.java index 1174922..c1b7a82 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/android/service/impl/UserServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/android/service/impl/UserServiceImpl.java @@ -31,18 +31,21 @@ public class UserServiceImpl implements UserService { return AjaxResult.success(new ArrayList<>()); } List moneyList = mapper.getMoneyList(); - // 构建 userId 到 moneyVo 的映射,提升查找效率 - Map moneyMap = moneyList.stream().collect(Collectors.toMap(UserInfoVo::getUserId, vo -> vo, (a, b) -> a)); - list.forEach(userInfoVo -> { - if (userInfoVo.getPhone().length() > PHONE_LENGTH) { - userInfoVo.setPhone(SM4EncryptUtils.sm4Decrypt(userInfoVo.getPhone())); - } - UserInfoVo money = moneyMap.get(userInfoVo.getUserId()); - if (money != null) { - userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance()); - userInfoVo.setSubsidiesBalance(money.getSubsidiesBalance()); - } - }); + if (!moneyList.isEmpty()){ + // 构建 userId 到 moneyVo 的映射,提升查找效率 + Map moneyMap = moneyList.stream().collect(Collectors.toMap(UserInfoVo::getUserId, vo -> vo, (a, b) -> a)); + list.forEach(userInfoVo -> { + if (userInfoVo.getPhone().length() > PHONE_LENGTH) { + userInfoVo.setPhone(SM4EncryptUtils.sm4Decrypt(userInfoVo.getPhone())); + } + UserInfoVo money = moneyMap.get(userInfoVo.getUserId()); + if (money != null) { + userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance()); + userInfoVo.setSubsidiesBalance(money.getSubsidiesBalance()); + } + + }); + } return AjaxResult.success(list); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/FaceMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/FaceMapper.xml index 488c57b..a04cf40 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/FaceMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/FaceMapper.xml @@ -11,8 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" face_state from user_face + + and user_id = #{userId} + - and update_time >= #{time} - INTERVAL 5 SECOND; + and update_time >= #{time} - INTERVAL 10 SECOND diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/UserMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/UserMapper.xml index 611efc3..5ad449c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/UserMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/UserMapper.xml @@ -4,31 +4,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">