feat(property): 新增入驻员工登录功能
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.dromara.property.api;
|
||||
|
||||
import org.dromara.common.core.exception.residentPerson.ResidentPersonException;
|
||||
import org.dromara.property.api.domain.vo.RemoteResidentPersonVo;
|
||||
import org.dromara.property.api.model.LoginResidentPerson;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,4 +18,13 @@ public interface RemoteResidentPersonService {
|
||||
|
||||
// 更新E8平台id
|
||||
Boolean updateE8Id(Long personId, Long e8Id);
|
||||
|
||||
/**
|
||||
* 通过手机号查询用户信息
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param tenantId 租户id
|
||||
* @return 结果
|
||||
*/
|
||||
LoginResidentPerson getResidentPersonInfo(String phone, String tenantId) throws ResidentPersonException;
|
||||
}
|
||||
|
@@ -0,0 +1,119 @@
|
||||
package org.dromara.property.api.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote LoginResidentPerson
|
||||
* @since 2025/9/5
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class LoginResidentPerson implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 所属单位id
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 所属单位名称
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 用户唯一标识
|
||||
*/
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
private Long loginTime;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Long expireTime;
|
||||
|
||||
/**
|
||||
* 登录IP地址
|
||||
*/
|
||||
private String ipaddr;
|
||||
|
||||
/**
|
||||
* 登录地点
|
||||
*/
|
||||
private String loginLocation;
|
||||
|
||||
/**
|
||||
* 浏览器类型
|
||||
*/
|
||||
private String browser;
|
||||
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
private String os;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 用户角色(1管理员2普通用户)
|
||||
*/
|
||||
private Integer userRoles;
|
||||
|
||||
/**
|
||||
* 客户端
|
||||
*/
|
||||
private String clientKey;
|
||||
|
||||
/**
|
||||
* 获取登录id
|
||||
*/
|
||||
public String getLoginId() {
|
||||
if (userType == null) {
|
||||
throw new IllegalArgumentException("用户类型不能为空");
|
||||
}
|
||||
if (userId == null) {
|
||||
throw new IllegalArgumentException("用户ID不能为空");
|
||||
}
|
||||
return userType + ":" + userId;
|
||||
}
|
||||
}
|
@@ -99,6 +99,11 @@
|
||||
<artifactId>ruoyi-common-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>property-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ELK 日志收集 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.dromara</groupId>-->
|
||||
|
@@ -0,0 +1,31 @@
|
||||
package org.dromara.auth.form;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.domain.model.LoginBody;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote ResidentLoginBody
|
||||
* @since 2025/9/5
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ResidentLoginBody extends LoginBody {
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@NotBlank(message = "{user.username.not.blank}")
|
||||
@Length(min = 2, max = 30, message = "{user.username.length.valid}")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
@NotBlank(message = "{user.password.not.blank}")
|
||||
@Length(min = 5, max = 30, message = "{user.password.length.valid}")
|
||||
private String password;
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
package org.dromara.auth.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.stp.parameter.SaLoginParameter;
|
||||
import cn.hutool.crypto.digest.BCrypt;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.auth.domain.vo.LoginVo;
|
||||
import org.dromara.auth.form.PasswordLoginBody;
|
||||
import org.dromara.auth.service.IAuthStrategy;
|
||||
import org.dromara.auth.service.SysLoginService;
|
||||
import org.dromara.common.core.enums.LoginType;
|
||||
import org.dromara.common.core.utils.ValidatorUtils;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.property.api.RemoteResidentPersonService;
|
||||
import org.dromara.property.api.model.LoginResidentPerson;
|
||||
import org.dromara.system.api.domain.vo.RemoteClientVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote ResidentAuthStrategy
|
||||
* @since 2025/9/5
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("resident" + IAuthStrategy.BASE_NAME)
|
||||
@RequiredArgsConstructor
|
||||
public class ResidentAuthStrategy implements IAuthStrategy {
|
||||
|
||||
private final SysLoginService loginService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteResidentPersonService remoteResidentPersonService;
|
||||
|
||||
@Override
|
||||
public LoginVo login(String body, RemoteClientVo client) {
|
||||
PasswordLoginBody loginBody = JsonUtils.parseObject(body, PasswordLoginBody.class);
|
||||
ValidatorUtils.validate(loginBody);
|
||||
assert loginBody != null;
|
||||
String tenantId = loginBody.getTenantId();
|
||||
String username = loginBody.getUsername();
|
||||
String password = loginBody.getPassword();
|
||||
|
||||
LoginResidentPerson loginUser = TenantHelper.dynamic(tenantId, () -> {
|
||||
LoginResidentPerson user = remoteResidentPersonService.getResidentPersonInfo(username, tenantId);
|
||||
loginService.checkLogin(LoginType.PASSWORD, tenantId, username, () -> !BCrypt.checkpw(password, user.getPassword()));
|
||||
return user;
|
||||
});
|
||||
loginUser.setClientKey(client.getClientKey());
|
||||
SaLoginParameter model = new SaLoginParameter();
|
||||
model.setDeviceType(client.getDeviceType());
|
||||
// 自定义分配 不同用户体系 不同 token 授权时间 不设置默认走全局 yml 配置
|
||||
// 例如: 后台用户30分钟过期 app用户1天过期
|
||||
model.setTimeout(client.getTimeout());
|
||||
model.setActiveTimeout(client.getActiveTimeout());
|
||||
model.setExtra(LoginHelper.CLIENT_KEY, client.getClientId());
|
||||
LoginHelper.residentLogin(loginUser, model);
|
||||
|
||||
LoginVo loginVo = new LoginVo();
|
||||
loginVo.setAccessToken(StpUtil.getTokenValue());
|
||||
loginVo.setExpireIn(StpUtil.getTokenTimeout());
|
||||
loginVo.setClientId(client.getClientId());
|
||||
return loginVo;
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package org.dromara.common.core.exception.residentPerson;
|
||||
|
||||
import org.dromara.common.core.exception.base.BaseException;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote ResidentPersonException
|
||||
* @since 2025/9/5
|
||||
*/
|
||||
public class ResidentPersonException extends BaseException {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ResidentPersonException(String message) {
|
||||
super("residentPerson", null, null, message);
|
||||
}
|
||||
}
|
@@ -35,6 +35,11 @@
|
||||
<artifactId>ruoyi-api-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>property-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common Redis-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
|
@@ -8,10 +8,13 @@ import org.dromara.common.core.service.PermissionService;
|
||||
import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.property.api.model.LoginResidentPerson;
|
||||
import org.dromara.system.api.model.LoginUser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* sa-token 权限管理实现类
|
||||
@@ -26,15 +29,30 @@ public class SaPermissionImpl implements StpInterface {
|
||||
@Override
|
||||
public List<String> getPermissionList(Object loginId, String loginType) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser) || !loginUser.getLoginId().equals(loginId)) {
|
||||
LoginResidentPerson loginResidentPerson = LoginHelper.getLoginResident();
|
||||
// 使用Objects.equals进行null安全的比较
|
||||
boolean isUserMatch = ObjectUtil.isNotNull(loginUser) && Objects.equals(loginUser.getLoginId(), loginId);
|
||||
boolean isResidentMatch = ObjectUtil.isNotNull(loginResidentPerson) && Objects.equals(loginResidentPerson.getLoginId(), loginId);
|
||||
if (isUserMatch) {
|
||||
// 用户匹配时的逻辑
|
||||
PermissionService permissionService = getPermissionService();
|
||||
if (ObjectUtil.isNotNull(permissionService)) {
|
||||
List<String> list = StringUtils.splitList(loginId.toString(), ":");
|
||||
return new ArrayList<>(permissionService.getMenuPermission(Long.parseLong(list.get(1))));
|
||||
} else {
|
||||
if (ObjectUtil.isNull(permissionService)) {
|
||||
throw new ServiceException("PermissionService 实现类不存在");
|
||||
}
|
||||
List<String> parts = StringUtils.splitList(loginId.toString(), ":");
|
||||
return new ArrayList<>(permissionService.getMenuPermission(Long.parseLong(parts.get(1))));
|
||||
} else if (isResidentMatch) {
|
||||
// 居民匹配时的逻辑
|
||||
return Arrays.asList(
|
||||
"resident:person:list",
|
||||
"resident:person:add",
|
||||
"resident:person:query",
|
||||
"resident:person:edit",
|
||||
"resident:person:remove"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
UserType userType = UserType.getUserType(loginUser.getUserType());
|
||||
if (userType == UserType.APP_USER) {
|
||||
// 其他端 自行根据业务编写
|
||||
|
@@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
|
||||
import org.dromara.common.core.constant.SystemConstants;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.enums.UserType;
|
||||
import org.dromara.property.api.model.LoginResidentPerson;
|
||||
import org.dromara.system.api.model.LoginUser;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -83,6 +84,57 @@ public class LoginHelper {
|
||||
return (T) session.get(LOGIN_USER_KEY);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 入驻员工
|
||||
*/
|
||||
private static final String UNIT_KEY = "unitId";
|
||||
public static final String UNIT_NAME_KEY = "unitName";
|
||||
private static final String RESIDENT_PERSON_KEY = "residentPerson";
|
||||
|
||||
/**
|
||||
* 登录系统 基于 设备类型
|
||||
* 针对相同用户体系不同设备
|
||||
*
|
||||
* @param loginUser 登录用户信息
|
||||
* @param model 配置参数
|
||||
*/
|
||||
public static void residentLogin(LoginResidentPerson loginUser, SaLoginParameter model) {
|
||||
model = ObjectUtil.defaultIfNull(model, new SaLoginParameter());
|
||||
StpUtil.login(loginUser.getLoginId(),
|
||||
model.setExtra(TENANT_KEY, loginUser.getTenantId())
|
||||
.setExtra(USER_KEY, loginUser.getUserId())
|
||||
.setExtra(USER_NAME_KEY, loginUser.getUsername())
|
||||
.setExtra(UNIT_KEY, loginUser.getUnitId())
|
||||
.setExtra(UNIT_NAME_KEY, loginUser.getUnitName())
|
||||
);
|
||||
StpUtil.getTokenSession().set(RESIDENT_PERSON_KEY, loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户(多级缓存)
|
||||
*/
|
||||
@SuppressWarnings("unchecked cast")
|
||||
public static <T extends LoginResidentPerson> T getLoginResident() {
|
||||
SaSession session = StpUtil.getTokenSession();
|
||||
if (ObjectUtil.isNull(session)) {
|
||||
return null;
|
||||
}
|
||||
return (T) session.get(RESIDENT_PERSON_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户基于token
|
||||
*/
|
||||
@SuppressWarnings("unchecked cast")
|
||||
public static <T extends LoginResidentPerson> T getLoginResident(String token) {
|
||||
SaSession session = StpUtil.getTokenSessionByToken(token);
|
||||
if (ObjectUtil.isNull(session)) {
|
||||
return null;
|
||||
}
|
||||
return (T) session.get(RESIDENT_PERSON_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户id
|
||||
*/
|
||||
|
@@ -9,8 +9,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.excel.core.ExcelResult;
|
||||
import org.dromara.property.domain.vo.ResidentPersonImportVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonImportVo;
|
||||
import org.dromara.property.listener.ResidentPersonImportListener;
|
||||
import org.dromara.property.utils.UploadFaceUtil;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -26,8 +25,8 @@ import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.bo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentPersonBo;
|
||||
import org.dromara.property.service.IResidentPersonService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@@ -17,8 +17,8 @@ import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.bo.ResidentUnitBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentUnitBo;
|
||||
import org.dromara.property.service.IResidentUnitService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
|
@@ -0,0 +1,114 @@
|
||||
package org.dromara.property.controller.xcx;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.property.api.model.LoginResidentPerson;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.service.IResidentPersonService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 移动端访问入驻员工
|
||||
* 前端访问路由地址为:/property/person
|
||||
*
|
||||
* @author mocheng
|
||||
* @since 2025-06-19
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/xcx/person")
|
||||
public class XResidentPersonController extends BaseController {
|
||||
|
||||
private final IResidentPersonService residentPersonService;
|
||||
/**
|
||||
* 获取登录员工信息
|
||||
*/
|
||||
@GetMapping("/getInfo")
|
||||
public R<ResidentPersonVo> getInfo() {
|
||||
LoginResidentPerson loginUser = LoginHelper.getLoginResident();
|
||||
ResidentPersonVo vo = new ResidentPersonVo();
|
||||
assert loginUser != null;
|
||||
vo.setId(loginUser.getUserId());
|
||||
vo.setUserName(loginUser.getUsername());
|
||||
vo.setUserRoles(loginUser.getUserRoles());
|
||||
vo.setUnitId(loginUser.getUnitId());
|
||||
vo.setUnitName(loginUser.getUnitName());
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单位未审核入驻员工列表
|
||||
*/
|
||||
@SaCheckPermission("resident:person:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ResidentPersonVo> list(ResidentPersonBo bo, PageQuery pageQuery) {
|
||||
return residentPersonService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取入驻员工详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("resident:person:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<ResidentPersonVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(residentPersonService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入驻员工
|
||||
*/
|
||||
@SaCheckPermission("resident:person:add")
|
||||
@Log(title = "入驻员工", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ResidentPersonBo bo) {
|
||||
return toAjax(residentPersonService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改入驻员工
|
||||
*/
|
||||
@SaCheckPermission("resident:person:edit")
|
||||
@Log(title = "入驻员工", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ResidentPersonBo bo) {
|
||||
return toAjax(residentPersonService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除入驻员工
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("resident:person:remove")
|
||||
@Log(title = "入驻员工", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(residentPersonService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package org.dromara.property.domain.bo;
|
||||
package org.dromara.property.domain.bo.residentBo;
|
||||
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
@@ -114,7 +114,7 @@ public class ResidentPersonBo extends BaseEntity {
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long state = 1L;
|
||||
private Integer state = 1;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -129,9 +129,10 @@ public class ResidentPersonBo extends BaseEntity {
|
||||
/**
|
||||
* 用户角色(1管理员2普通用户)
|
||||
*/
|
||||
private String userRoles;
|
||||
private Integer userRoles;
|
||||
|
||||
/**
|
||||
* 是否审核通过(1通过2不通过)
|
||||
*/
|
||||
private String isAudit;
|
||||
private Integer isAudit;
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package org.dromara.property.domain.bo;
|
||||
package org.dromara.property.domain.bo.residentBo;
|
||||
|
||||
import org.dromara.property.domain.ResidentUnit;
|
||||
import org.dromara.property.domain.entity.resident.ResidentUnit;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
@@ -1,4 +1,4 @@
|
||||
package org.dromara.property.domain;
|
||||
package org.dromara.property.domain.entity.resident;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
@@ -87,15 +87,15 @@ public class ResidentPerson extends TenantEntity {
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long state;
|
||||
private Integer state;
|
||||
/**
|
||||
* 用户角色(1管理员2普通用户)
|
||||
*/
|
||||
private String userRoles;
|
||||
private Integer userRoles;
|
||||
/**
|
||||
* 是否审核通过(1通过2不通过)
|
||||
*/
|
||||
private String isAudit;
|
||||
private Integer isAudit;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
@@ -1,4 +1,4 @@
|
||||
package org.dromara.property.domain;
|
||||
package org.dromara.property.domain.entity.resident;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
@@ -2,11 +2,9 @@ package org.dromara.property.domain.vo;
|
||||
|
||||
import org.dromara.property.domain.MeetParticipants;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
@@ -1,17 +1,13 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
package org.dromara.property.domain.vo.residentVo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
@@ -1,7 +1,8 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
package org.dromara.property.domain.vo.residentVo;
|
||||
|
||||
import java.util.Date;
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
@@ -11,7 +12,6 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 入驻员工视图对象 resident_person
|
||||
*
|
||||
@@ -102,7 +102,7 @@ public class ResidentPersonVo implements Serializable {
|
||||
* 状态
|
||||
*/
|
||||
@ExcelProperty(value = "状态")
|
||||
private Long state;
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -143,5 +143,20 @@ public class ResidentPersonVo implements Serializable {
|
||||
*/
|
||||
private Integer rosterType;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 用户角色(1管理员2普通用户)
|
||||
*/
|
||||
private Integer userRoles;
|
||||
|
||||
/**
|
||||
* 是否审核通过(1通过2不通过)
|
||||
*/
|
||||
private Integer isAudit;
|
||||
|
||||
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
package org.dromara.property.domain.vo.residentVo;
|
||||
|
||||
import java.util.Date;
|
||||
import org.dromara.property.domain.ResidentUnit;
|
||||
import org.dromara.property.domain.entity.resident.ResidentUnit;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
@@ -1,12 +1,16 @@
|
||||
package org.dromara.property.dubbo;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.property.api.RemoteResidentPersonService;
|
||||
import org.dromara.property.api.domain.vo.RemoteResidentPersonVo;
|
||||
import org.dromara.property.domain.bo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.api.model.LoginResidentPerson;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.common.core.exception.residentPerson.ResidentPersonException;
|
||||
import org.dromara.property.service.IResidentPersonService;
|
||||
|
||||
import java.util.List;
|
||||
@@ -52,4 +56,44 @@ public class RemoteResidentPersonServiceImpl implements RemoteResidentPersonServ
|
||||
return residentPersonService.updateByBo(bo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过手机号查询用户信息
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param tenantId 租户id
|
||||
* @return 结果
|
||||
*/
|
||||
public LoginResidentPerson getResidentPersonInfo(String phone, String tenantId) throws ResidentPersonException {
|
||||
return TenantHelper.dynamic(tenantId, () -> {
|
||||
ResidentPersonVo vo = residentPersonService.queryByPhone(phone, tenantId);
|
||||
if (ObjectUtil.isEmpty(vo)) {
|
||||
throw new ResidentPersonException("入驻员工");
|
||||
}
|
||||
if (vo.getIsAudit() == null || vo.getIsAudit() != 1) {
|
||||
throw new ResidentPersonException("当前员工未审核");
|
||||
}
|
||||
|
||||
if (vo.getState() == 0) {
|
||||
throw new ResidentPersonException("当前员工账号被禁用");
|
||||
}
|
||||
|
||||
if (vo.getState() == 2) {
|
||||
throw new ResidentPersonException("当前员工已离职");
|
||||
}
|
||||
|
||||
LoginResidentPerson login = new LoginResidentPerson();
|
||||
login.setTenantId(tenantId);
|
||||
login.setUserId(vo.getId());
|
||||
login.setUsername(vo.getUserName());
|
||||
login.setNickname(vo.getUserName());
|
||||
login.setPassword(vo.getPassword());
|
||||
login.setUserRoles(vo.getUserRoles());
|
||||
login.setUnitId(vo.getUnitId());
|
||||
login.setUnitName(vo.getUnitName());
|
||||
login.setUserType("resident_person");
|
||||
return login;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,14 +15,13 @@ import org.dromara.common.core.utils.ValidatorUtils;
|
||||
import org.dromara.common.excel.core.ExcelListener;
|
||||
import org.dromara.common.excel.core.ExcelResult;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.property.domain.bo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonImportVo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonImportVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.service.IResidentPersonService;
|
||||
import org.dromara.property.service.IResidentUnitService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -69,7 +68,7 @@ public class ResidentPersonImportListener extends AnalysisEventListener<Resident
|
||||
if (person == null) { // 判断当前单位是否已存在该用户
|
||||
ResidentPersonBo bo = BeanUtil.toBean(personVo, ResidentPersonBo.class);
|
||||
ValidatorUtils.validate(bo);
|
||||
bo.setState(1L);
|
||||
bo.setState(1);
|
||||
bo.setUnitId(unitId);
|
||||
bo.setTime(new Date());
|
||||
bo.setUnitName(unitVo.getName().trim());
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package org.dromara.property.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package org.dromara.property.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.property.domain.ResidentUnit;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.entity.resident.ResidentUnit;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package org.dromara.property.service;
|
||||
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.bo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentPersonBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
@@ -24,6 +24,15 @@ public interface IResidentPersonService {
|
||||
*/
|
||||
ResidentPersonVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询入驻员工
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param tenantId 租户id
|
||||
* @return 入驻员工
|
||||
*/
|
||||
ResidentPersonVo queryByPhone(String phone, String tenantId);
|
||||
|
||||
/**
|
||||
* 分页查询入驻员工列表
|
||||
*
|
||||
|
@@ -1,8 +1,7 @@
|
||||
package org.dromara.property.service;
|
||||
|
||||
import org.dromara.property.domain.ResidentUnit;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.bo.ResidentUnitBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentUnitBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
@@ -13,7 +12,7 @@ import java.util.List;
|
||||
* 入驻单位Service接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-06-19
|
||||
* @since 2025-06-19
|
||||
*/
|
||||
public interface IResidentUnitService {
|
||||
|
||||
|
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.*;
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
import org.dromara.property.domain.vo.CapitalInfoVo;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@@ -17,13 +17,13 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.domain.*;
|
||||
import org.dromara.property.domain.bo.CostCarChargeBo;
|
||||
import org.dromara.property.domain.bo.CostChargeReturnFeeBo;
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
import org.dromara.property.domain.enums.ChargeStatusEnum;
|
||||
import org.dromara.property.domain.vo.CostCarChargeVo;
|
||||
import org.dromara.property.domain.vo.CostItemsVo;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.dromara.property.service.ICostCarChargeService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -31,8 +31,6 @@ import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 费用-车辆收费Service业务层处理
|
||||
|
@@ -17,11 +17,12 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.*;
|
||||
import org.dromara.property.domain.bo.CostChargeReturnFeeBo;
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
import org.dromara.property.domain.enums.ChargeStatusEnum;
|
||||
import org.dromara.property.domain.vo.*;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.CostHouseChargeBo;
|
||||
import org.dromara.property.service.ICostHouseChargeService;
|
||||
|
@@ -11,15 +11,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.property.domain.CostReturnPayFee;
|
||||
import org.dromara.property.domain.CustomerContingenPlan;
|
||||
import org.dromara.property.domain.CustomerContingenPlanRecord;
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
import org.dromara.property.domain.bo.CustomerContingenPlanBo;
|
||||
import org.dromara.property.domain.vo.CustomerContingenPlanRecordVo;
|
||||
import org.dromara.property.domain.vo.CustomerContingenPlanVo;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.mapper.CustomerContingenPlanMapper;
|
||||
import org.dromara.property.mapper.CustomerContingenPlanRecordMapper;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
|
@@ -24,9 +24,8 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.domain.*;
|
||||
import org.dromara.property.domain.bo.InspectionPlanBo;
|
||||
import org.dromara.property.domain.bo.InspectionPlanStaffBo;
|
||||
import org.dromara.property.domain.bo.MachineMaintainPlanBo;
|
||||
import org.dromara.property.domain.bo.MachineMaintainPlanStaffBo;
|
||||
import org.dromara.property.domain.vo.*;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.dromara.property.service.IInspectionPlanService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
|
@@ -11,9 +11,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.MachineMaintainTask;
|
||||
import org.dromara.property.domain.MachineType;
|
||||
import org.dromara.property.domain.vo.*;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.mapper.MachineLocationMapper;
|
||||
import org.dromara.property.mapper.MachineTypeMapper;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
|
@@ -14,15 +14,15 @@ import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.domain.MeetAttach;
|
||||
import org.dromara.property.domain.MeetAttachOrder;
|
||||
import org.dromara.property.domain.MeetBooking;
|
||||
import org.dromara.property.domain.bo.MeetBookingBo;
|
||||
import org.dromara.property.domain.vo.*;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.dromara.property.service.IMeetBookingService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@@ -11,10 +11,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.bo.MeetBookingBo;
|
||||
import org.dromara.property.domain.vo.MeetBookingVo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.mapper.MeetBookingMapper;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
import org.dromara.property.mapper.ResidentUnitMapper;
|
||||
@@ -27,8 +26,6 @@ import org.dromara.property.service.IMeetParticipantsService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 会议室参会记录Service业务层处理
|
||||
|
@@ -1,10 +1,8 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -16,8 +14,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.MeetAttach;
|
||||
import org.dromara.property.domain.MeetBooking;
|
||||
import org.dromara.property.domain.vo.MeetAttachVo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
@@ -34,7 +30,6 @@ import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.crypto.digest.BCrypt;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
@@ -11,16 +12,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.Questionnaire;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.service.IResidentUnitService;
|
||||
import org.dromara.sis.api.RemoteSisAuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
import org.dromara.property.service.IResidentPersonService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -59,7 +59,23 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
*/
|
||||
@Override
|
||||
public ResidentPersonVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
ResidentPersonVo residentPersonVo = baseMapper.selectVoById(id);
|
||||
residentPersonVo.setPassword(null);
|
||||
return residentPersonVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询入驻员工
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param tenantId 租户id
|
||||
* @return 入驻员工
|
||||
*/
|
||||
@Override
|
||||
public ResidentPersonVo queryByPhone(String phone, String tenantId) {
|
||||
return baseMapper.selectVoOne(new LambdaQueryWrapper<ResidentPerson>()
|
||||
.eq(ResidentPerson::getPhone, phone)
|
||||
.eq(ResidentPerson::getTenantId, tenantId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,6 +89,9 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
public TableDataInfo<ResidentPersonVo> queryPageList(ResidentPersonBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<ResidentPerson> lqw = buildQueryWrapper(bo);
|
||||
Page<ResidentPersonVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
result.getRecords().forEach(s -> {
|
||||
s.setPassword(null);
|
||||
});
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -85,7 +104,11 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
@Override
|
||||
public List<ResidentPersonVo> queryList(ResidentPersonBo bo) {
|
||||
LambdaQueryWrapper<ResidentPerson> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
List<ResidentPersonVo> residentPersonVos = baseMapper.selectVoList(lqw);
|
||||
residentPersonVos.forEach(s -> {
|
||||
s.setPassword(null);
|
||||
});
|
||||
return residentPersonVos;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ResidentPerson> buildQueryWrapper(ResidentPersonBo bo) {
|
||||
@@ -123,10 +146,11 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
|
||||
// 首次入驻新用户权限组默认使用公司权限
|
||||
ResidentUnitVo ruVo = residentUnitService.queryById(bo.getUnitId());
|
||||
add.setPassword("123456");
|
||||
// 密码加密,不存明文密码
|
||||
add.setPassword(BCrypt.hashpw("123456"));
|
||||
//查询该单位下是否有管理员
|
||||
new LambdaQueryWrapper<ResidentPerson>().eq(ResidentPerson::getUnitId, bo.getUnitId())
|
||||
.eq(ResidentPerson::getUserRoles, "1");
|
||||
.eq(ResidentPerson::getUserRoles, 1);
|
||||
|
||||
add.setAuthGroupId(ruVo.getAuthGroupId());
|
||||
add.setAuthBegDate(ruVo.getAuthBegDate());
|
||||
@@ -188,7 +212,7 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
private void validEntityBeforeSave(ResidentPerson entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
LambdaQueryWrapper<ResidentPerson> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(ResidentPerson::getIdCard, entity.getUserName())
|
||||
lqw.eq(ResidentPerson::getPhone, entity.getPhone())
|
||||
.eq(ResidentPerson::getUnitId, entity.getUnitId());
|
||||
boolean exists = baseMapper.exists(lqw);
|
||||
Assert.isTrue(!exists, "当前单位,{}已入驻!", entity.getUserName());
|
||||
|
@@ -10,14 +10,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
import org.dromara.property.service.IResidentPersonService;
|
||||
import org.dromara.property.service.ITbRoomService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.ResidentUnitBo;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.ResidentUnit;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentUnitBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.entity.resident.ResidentUnit;
|
||||
import org.dromara.property.mapper.ResidentUnitMapper;
|
||||
import org.dromara.property.service.IResidentUnitService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
|
||||
* 入驻单位Service业务层处理
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-06-19
|
||||
* @since 2025-06-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@@ -139,16 +139,16 @@ public class ResidentUnitServiceImpl implements IResidentUnitService {
|
||||
|
||||
/**
|
||||
* 新增一个管理员
|
||||
* @param unit
|
||||
* @param unit 入驻单位
|
||||
*/
|
||||
private void addResidentPerson(ResidentUnit unit) {
|
||||
ResidentPerson residentPerson = new ResidentPerson();
|
||||
residentPerson.setUserName(unit.getContactPerson());
|
||||
residentPerson.setPhone(unit.getPhone().toString());
|
||||
residentPerson.setGender(1L);
|
||||
residentPerson.setState(2L);
|
||||
residentPerson.setUserRoles("1");
|
||||
residentPerson.setIsAudit("1");
|
||||
residentPerson.setState(2);
|
||||
residentPerson.setUserRoles(1);
|
||||
residentPerson.setIsAudit(1);
|
||||
residentPerson.setAuthGroupId(unit.getAuthGroupId());
|
||||
residentPerson.setAuthBegDate(unit.getAuthBegDate());
|
||||
residentPerson.setAuthEndDate(unit.getAuthEndDate());
|
||||
|
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.ResidentUnit;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.ServerBookingBo;
|
||||
import org.dromara.property.domain.vo.ServerBookingVo;
|
||||
|
@@ -301,6 +301,7 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService {
|
||||
private Map<String, Object> trendMonthData(String floorId, String meterId, Long meterType, String year) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
List<Map<String, Object>> monthList = baseMapper.getMonthTrend(StrUtil.isBlank(floorId) ? null : Long.parseLong(floorId), StrUtil.isBlank(meterId) ? null : Long.parseLong(meterId), meterType, year);
|
||||
log.info("year:{},monthList:{}", year, monthList);
|
||||
List<String[]> monthData = new ArrayList<>();
|
||||
monthList.forEach(item -> monthData.add(new String[]{item.get("month").toString(), item.get("total_consumption").toString()}));
|
||||
Float total = monthList.stream().map(map -> new BigDecimal(map.get("total_consumption").toString())).reduce(BigDecimal::add).orElse(BigDecimal.ZERO).floatValue();
|
||||
|
@@ -13,7 +13,7 @@ import org.dromara.property.domain.InspectionTask;
|
||||
import org.dromara.property.domain.bo.InspectionPlanBo;
|
||||
import org.dromara.property.domain.vo.InspectionPlanStaffVo;
|
||||
import org.dromara.property.domain.vo.InspectionPlanVo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.mapper.InspectionPlanStaffMapper;
|
||||
import org.dromara.property.mapper.InspectionTaskMapper;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
@@ -21,10 +21,6 @@ import org.dromara.property.service.IInspectionPlanService;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
@@ -35,8 +31,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.dromara.common.mybatis.core.mapper.BaseMapperPlus.log;
|
||||
|
||||
/**
|
||||
* @Author:yuyongle
|
||||
* @Date:2025/7/11 15:28
|
||||
|
@@ -14,7 +14,7 @@ import org.dromara.property.domain.MachineMaintainTask;
|
||||
import org.dromara.property.domain.bo.MachineMaintainPlanBo;
|
||||
import org.dromara.property.domain.vo.MachineMaintainPlanStaffVo;
|
||||
import org.dromara.property.domain.vo.MachineMaintainPlanVo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.mapper.MachineMaintainPlanStaffMapper;
|
||||
import org.dromara.property.mapper.MachineMaintainTaskMapper;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
@@ -22,10 +22,6 @@ import org.dromara.property.service.IMachineMaintainPlanService;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
@@ -36,8 +32,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.dromara.common.mybatis.core.mapper.BaseMapperPlus.log;
|
||||
|
||||
/**
|
||||
* @Author:yuyongle
|
||||
* @Date:2025/7/17 09:25
|
||||
|
@@ -4,8 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.property.domain.bo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.service.IResidentPersonService;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
|
@@ -53,8 +53,8 @@
|
||||
<if test="meterId != '' and meterId != null">
|
||||
AND a.meter_id = #{meterId}
|
||||
</if>
|
||||
GROUP BY MONTH(reading_time)
|
||||
ORDER BY `month`;
|
||||
GROUP BY `month`
|
||||
ORDER BY `month`
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user