双屏机查询人脸、人员信息条件优化

This commit is contained in:
jjLv 2025-06-05 15:01:11 +08:00
parent b3cd13d4a4
commit 11b71392f6
3 changed files with 35 additions and 30 deletions

View File

@ -31,18 +31,21 @@ public class UserServiceImpl implements UserService {
return AjaxResult.success(new ArrayList<>()); return AjaxResult.success(new ArrayList<>());
} }
List<UserInfoVo> moneyList = mapper.getMoneyList(); List<UserInfoVo> moneyList = mapper.getMoneyList();
// 构建 userId moneyVo 的映射提升查找效率 if (!moneyList.isEmpty()){
Map<String, UserInfoVo> moneyMap = moneyList.stream().collect(Collectors.toMap(UserInfoVo::getUserId, vo -> vo, (a, b) -> a)); // 构建 userId moneyVo 的映射提升查找效率
list.forEach(userInfoVo -> { Map<String, UserInfoVo> moneyMap = moneyList.stream().collect(Collectors.toMap(UserInfoVo::getUserId, vo -> vo, (a, b) -> a));
if (userInfoVo.getPhone().length() > PHONE_LENGTH) { list.forEach(userInfoVo -> {
userInfoVo.setPhone(SM4EncryptUtils.sm4Decrypt(userInfoVo.getPhone())); if (userInfoVo.getPhone().length() > PHONE_LENGTH) {
} userInfoVo.setPhone(SM4EncryptUtils.sm4Decrypt(userInfoVo.getPhone()));
UserInfoVo money = moneyMap.get(userInfoVo.getUserId()); }
if (money != null) { UserInfoVo money = moneyMap.get(userInfoVo.getUserId());
userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance()); if (money != null) {
userInfoVo.setSubsidiesBalance(money.getSubsidiesBalance()); userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance());
} userInfoVo.setSubsidiesBalance(money.getSubsidiesBalance());
}); }
});
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }

View File

@ -11,8 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
face_state face_state
from user_face from user_face
<where> <where>
<if test="userId != null and userId != '' and userId != 0 and userId != '0'">
and user_id = #{userId}
</if>
<if test="time != null and time != ''"> <if test="time != null and time != ''">
and update_time >= #{time} - INTERVAL 5 SECOND; and update_time >= #{time} - INTERVAL 10 SECOND
</if> </if>
</where> </where>
</select> </select>

View File

@ -4,31 +4,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.android.mapper.UserMapper"> <mapper namespace="com.bonus.canteen.core.android.mapper.UserMapper">
<select id="getUserInfo" resultType="com.bonus.canteen.core.android.vo.UserInfoVo"> <select id="getUserInfo" resultType="com.bonus.canteen.core.android.vo.UserInfoVo">
select select su.user_id as userId,
su.user_id as userId, su.user_name as userName,
su.user_name as userName, su.nick_name as nickName,
su.nick_name as nickName, ac.account_id as accId,
ac.account_id as accId, '' as cardNum,
'' as cardNum, ac.serial_num as serialNum,
ac.serial_num as serialNum, ai.account_status as accStatus,
ai.account_status as accStatus, su.phonenumber as phone,
su.phonenumber as phone, su.login_type as loginType
su.login_type as loginType
from sys_user su from sys_user su
left join account_card ac on ac.user_id = su.user_id left join account_card ac on ac.user_id = su.user_id
left join account_info ai on ai.user_id = su.user_id left join account_info ai on ai.user_id = su.user_id
where ai.del_flag = '0' where ai.del_flag = '0'
<if test="userId != null and userId != '' and userId != 0 and userId != '0'"> <if test="userId != null and userId != '' and userId != 0 and userId != '0'">
AND su.user_id = #{userId} AND su.user_id = #{userId}
</if> </if>
<if test="type == 'user'"> <if test="type == 'user'">
<if test="time != null and time != ''"> <if test="time != null and time != ''">
AND su.update_time >= (#{time} - INTERVAL 5 SECOND) AND su.update_time >= (#{time} - INTERVAL 10 SECOND)
</if> </if>
</if> </if>
<if test="type == 'card'"> <if test="type == 'card'">
<if test="time != null and time != ''"> <if test="time != null and time != ''">
AND ac.update_time >= (#{time} - INTERVAL 5 SECOND) AND ac.update_time >= (#{time} - INTERVAL 10 SECOND)
</if> </if>
</if> </if>
</select> </select>