Compare commits

...

4 Commits

4 changed files with 24 additions and 48 deletions

View File

@ -14,12 +14,10 @@ import com.fuyuanshen.common.core.constant.SystemConstants;
import com.fuyuanshen.common.core.domain.model.AppLoginUser;
import com.fuyuanshen.common.core.domain.model.SmsLoginBody;
import com.fuyuanshen.common.core.enums.LoginType;
import com.fuyuanshen.common.core.enums.UserType;
import com.fuyuanshen.common.core.exception.user.CaptchaExpireException;
import com.fuyuanshen.common.core.exception.user.UserException;
import com.fuyuanshen.common.core.utils.MessageUtils;
import com.fuyuanshen.common.core.utils.ServletUtils;
import com.fuyuanshen.common.core.utils.StringUtils;
import com.fuyuanshen.common.core.utils.ValidatorUtils;
import com.fuyuanshen.common.core.utils.*;
import com.fuyuanshen.common.json.utils.JsonUtils;
import com.fuyuanshen.common.redis.utils.RedisUtils;
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
@ -60,9 +58,9 @@ public class AppSmsAuthStrategy implements IAuthStrategy {
AppUserVo user = loadUserByPhonenumber(phonenumber);
if (ObjectUtil.isNull(user)) {
//新增Appuser
addAppUser(tenantId, phonenumber);
user = appUserMapper.selectVoOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhonenumber, phonenumber));
AppUser appUser = addAppUser(tenantId, phonenumber);
MapstructUtils.convert(appUser, user);
// user = appUserMapper.selectVoOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhonenumber, phonenumber));
// loginService.recordLogininfor(tenantId, phonenumber, Constants.LOGIN_FAIL, MessageUtils.message("user.not.exists", phonenumber));
// throw new UserException("user.not.exists", phonenumber);
}
@ -89,7 +87,7 @@ public class AppSmsAuthStrategy implements IAuthStrategy {
return loginVo;
}
private void addAppUser(String tenantId, String phonenumber) {
private AppUser addAppUser(String tenantId, String phonenumber) {
AppUser appUser = new AppUser();
appUser.setPhonenumber(phonenumber);
appUser.setUserName(phonenumber);
@ -98,6 +96,7 @@ public class AppSmsAuthStrategy implements IAuthStrategy {
appUser.setLoginIp(ServletUtils.getClientIP());
appUser.setTenantId(tenantId);
appUserMapper.insert(appUser);
return appUser;
}
@ -114,7 +113,9 @@ public class AppSmsAuthStrategy implements IAuthStrategy {
}
private AppUserVo loadUserByPhonenumber(String phonenumber) {
AppUserVo user = appUserMapper.selectVoOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhonenumber, phonenumber));
AppUserVo user = appUserMapper.selectVoOne(new LambdaQueryWrapper<AppUser>()
.eq(AppUser::getPhonenumber, phonenumber)
.eq(AppUser::getUserType, UserType.APP_USER.getUserType()));
if (ObjectUtil.isNull(user)) {
log.info("登录用户:{} 不存在.", phonenumber);
// throw new UserException("user.not.exists", phonenumber);
@ -126,5 +127,4 @@ public class AppSmsAuthStrategy implements IAuthStrategy {
}
return user;
}
}

View File

@ -2,6 +2,7 @@ package com.fuyuanshen.app.controller;
import java.util.List;
import com.fuyuanshen.common.core.enums.UserType;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
@ -36,12 +37,14 @@ public class AppUserController extends BaseController {
private final IAppUserService appUserService;
/**
* 查询APP用户信息列表
*/
// @SaCheckPermission("app:user:list")
@GetMapping("/list")
public TableDataInfo<AppUserVo> list(AppUserBo bo, PageQuery pageQuery) {
bo.setUserType(UserType.APP_USER.getUserType());
return appUserService.queryPageList(bo, pageQuery);
}

View File

@ -1,6 +1,9 @@
package com.fuyuanshen.app.domain.vo;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuyuanshen.app.domain.AppUser;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
@ -120,4 +123,10 @@ public class AppUserVo implements Serializable {
* 部门ID
*/
private Long deptId;
/**
* 创建时间
*/
private Date createTime;
}

View File

@ -36,48 +36,12 @@
d.device_imei, d.longitude, d.latitude, d.tenant_id
</sql>
<!-- 分页查询设备 -->
<select id="findAll1" resultType="com.fuyuanshen.equipment.domain.Device">
select d.* , t.type_name
FROM device d
LEFT JOIN device_type t ON d.device_type = t.id
<where>
<!-- 时间范围等其他条件保持原样 -->
<if test="criteria.deviceName != null and criteria.deviceName.trim() != ''">
and d.device_name like concat('%', TRIM(#{criteria.deviceName}), '%')
</if>
<if test="criteria.deviceMac != null">
and d.device_mac = #{criteria.deviceMac}
</if>
<if test="criteria.deviceImei != null">
and d.device_imei = #{criteria.deviceImei}
</if>
<if test="criteria.deviceType != null">
and d.device_type = #{criteria.deviceType}
</if>
<if test="criteria.deviceStatus != null">
and d.device_status = #{criteria.deviceStatus}
</if>
<if test="criteria.currentOwnerId != null">
and d.current_owner_id = #{criteria.currentOwnerId}
</if>
<if test="criteria.params.beginTime != null and criteria.params.endTime != null">
and d.create_time between #{criteria.params.beginTime} and #{criteria.params.endTime}
</if>
<if test="criteria.tenantId != null">
AND tenant_id = #{criteria.tenantId}
</if>
</where>
order by d.create_time desc
</select>
<!-- 分页查询设备 -->
<select id="findAll" resultType="com.fuyuanshen.equipment.domain.Device">
select
da.id AS id,d.device_name,d.bluetooth_name,
d.device_pic, d.device_mac, d.device_sn, d.update_by,d.device_imei,
d.update_time, dg.id AS device_type, d.remark, d.binding_status,d.type_name AS typeName,
d.update_time, dg.id AS device_type, d.remark, d.binding_status,t.type_name AS typeName,
da.assignee_id AS customerId, da.assignee_name AS customerName, da.active AS deviceStatus,
da.create_time AS create_time , da.assigner_name AS createByName , da.id AS assignId
from device d
@ -166,7 +130,7 @@
<!-- 查询APP绑定设备列表 -->
<select id="queryAppBindDeviceList" resultType="com.fuyuanshen.equipment.domain.vo.AppDeviceVo">
select d.id, d.device_name, d.device_name,
select d.id, d.device_name, d.device_name,
d.device_name,
d.device_mac,
d.device_sn,