diff --git a/ruoyi-api/property-api/src/main/java/org/dromara/property/api/RemoteResidentPersonService.java b/ruoyi-api/property-api/src/main/java/org/dromara/property/api/RemoteResidentPersonService.java index b3d4986c..0ab4d6f5 100644 --- a/ruoyi-api/property-api/src/main/java/org/dromara/property/api/RemoteResidentPersonService.java +++ b/ruoyi-api/property-api/src/main/java/org/dromara/property/api/RemoteResidentPersonService.java @@ -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; } diff --git a/ruoyi-api/property-api/src/main/java/org/dromara/property/api/model/LoginResidentPerson.java b/ruoyi-api/property-api/src/main/java/org/dromara/property/api/model/LoginResidentPerson.java new file mode 100644 index 00000000..99a9d9a6 --- /dev/null +++ b/ruoyi-api/property-api/src/main/java/org/dromara/property/api/model/LoginResidentPerson.java @@ -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; + } +} diff --git a/ruoyi-auth/pom.xml b/ruoyi-auth/pom.xml index 902f1c44..fff261f1 100644 --- a/ruoyi-auth/pom.xml +++ b/ruoyi-auth/pom.xml @@ -99,6 +99,11 @@ ruoyi-common-loadbalancer + + org.dromara + property-api + + diff --git a/ruoyi-auth/src/main/java/org/dromara/auth/form/ResidentLoginBody.java b/ruoyi-auth/src/main/java/org/dromara/auth/form/ResidentLoginBody.java new file mode 100644 index 00000000..818ca029 --- /dev/null +++ b/ruoyi-auth/src/main/java/org/dromara/auth/form/ResidentLoginBody.java @@ -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; +} diff --git a/ruoyi-auth/src/main/java/org/dromara/auth/service/impl/ResidentAuthStrategy.java b/ruoyi-auth/src/main/java/org/dromara/auth/service/impl/ResidentAuthStrategy.java new file mode 100644 index 00000000..3c23b388 --- /dev/null +++ b/ruoyi-auth/src/main/java/org/dromara/auth/service/impl/ResidentAuthStrategy.java @@ -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; + } +} diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/residentPerson/ResidentPersonException.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/residentPerson/ResidentPersonException.java new file mode 100644 index 00000000..eae962d8 --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/residentPerson/ResidentPersonException.java @@ -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); + } +} diff --git a/ruoyi-common/ruoyi-common-satoken/pom.xml b/ruoyi-common/ruoyi-common-satoken/pom.xml index 5643acb8..82beefe3 100644 --- a/ruoyi-common/ruoyi-common-satoken/pom.xml +++ b/ruoyi-common/ruoyi-common-satoken/pom.xml @@ -35,6 +35,11 @@ ruoyi-api-system + + org.dromara + property-api + + org.dromara diff --git a/ruoyi-common/ruoyi-common-satoken/src/main/java/org/dromara/common/satoken/core/service/SaPermissionImpl.java b/ruoyi-common/ruoyi-common-satoken/src/main/java/org/dromara/common/satoken/core/service/SaPermissionImpl.java index e6b0404f..7b0b2125 100644 --- a/ruoyi-common/ruoyi-common-satoken/src/main/java/org/dromara/common/satoken/core/service/SaPermissionImpl.java +++ b/ruoyi-common/ruoyi-common-satoken/src/main/java/org/dromara/common/satoken/core/service/SaPermissionImpl.java @@ -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 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 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 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) { // 其他端 自行根据业务编写 diff --git a/ruoyi-common/ruoyi-common-satoken/src/main/java/org/dromara/common/satoken/utils/LoginHelper.java b/ruoyi-common/ruoyi-common-satoken/src/main/java/org/dromara/common/satoken/utils/LoginHelper.java index 7d2136e6..69bd60ec 100644 --- a/ruoyi-common/ruoyi-common-satoken/src/main/java/org/dromara/common/satoken/utils/LoginHelper.java +++ b/ruoyi-common/ruoyi-common-satoken/src/main/java/org/dromara/common/satoken/utils/LoginHelper.java @@ -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 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 getLoginResident(String token) { + SaSession session = StpUtil.getTokenSessionByToken(token); + if (ObjectUtil.isNull(session)) { + return null; + } + return (T) session.get(RESIDENT_PERSON_KEY); + } + /** * 获取用户id */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ResidentPersonController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ResidentPersonController.java index 2ac858dc..773c5223 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ResidentPersonController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ResidentPersonController.java @@ -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; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ResidentUnitController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ResidentUnitController.java index bc8a7e0e..0ae747e8 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ResidentUnitController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/ResidentUnitController.java @@ -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; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/xcx/XResidentPersonController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/xcx/XResidentPersonController.java new file mode 100644 index 00000000..43491054 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/xcx/XResidentPersonController.java @@ -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 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 list(ResidentPersonBo bo, PageQuery pageQuery) { + return residentPersonService.queryPageList(bo, pageQuery); + } + + /** + * 获取入驻员工详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("resident:person:query") + @GetMapping("/{id}") + public R 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 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 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 remove(@NotEmpty(message = "主键不能为空") + @PathVariable("ids") Long[] ids) { + return toAjax(residentPersonService.deleteWithValidByIds(List.of(ids), true)); + } + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentPersonBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/residentBo/ResidentPersonBo.java similarity index 92% rename from ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentPersonBo.java rename to ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/residentBo/ResidentPersonBo.java index 47fbb1c2..15eca760 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentPersonBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/residentBo/ResidentPersonBo.java @@ -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; } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentUnitBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/residentBo/ResidentUnitBo.java similarity index 95% rename from ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentUnitBo.java rename to ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/residentBo/ResidentUnitBo.java index 95612baf..1aade1e7 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentUnitBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/residentBo/ResidentUnitBo.java @@ -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; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentPerson.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/entity/resident/ResidentPerson.java similarity index 93% rename from ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentPerson.java rename to ruoyi-modules/Property/src/main/java/org/dromara/property/domain/entity/resident/ResidentPerson.java index 00f96171..addd508e 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentPerson.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/entity/resident/ResidentPerson.java @@ -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; /** * 备注 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentUnit.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/entity/resident/ResidentUnit.java similarity index 96% rename from ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentUnit.java rename to ruoyi-modules/Property/src/main/java/org/dromara/property/domain/entity/resident/ResidentUnit.java index 8faa2608..0b5d4986 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentUnit.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/entity/resident/ResidentUnit.java @@ -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.*; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/MeetParticipantsVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/MeetParticipantsVo.java index 9cb0c6a3..35fbc0fc 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/MeetParticipantsVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/MeetParticipantsVo.java @@ -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; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonImportVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentPersonImportVo.java similarity index 85% rename from ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonImportVo.java rename to ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentPersonImportVo.java index b849480e..ebb89f9b 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonImportVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentPersonImportVo.java @@ -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; /** diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentPersonVo.java similarity index 86% rename from ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonVo.java rename to ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentPersonVo.java index 88f0d0b2..9cb930f6 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentPersonVo.java @@ -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; + } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentUnitVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentUnitVo.java similarity index 94% rename from ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentUnitVo.java rename to ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentUnitVo.java index 2e9cc0f6..e93abf8d 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentUnitVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentUnitVo.java @@ -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; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/dubbo/RemoteResidentPersonServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/dubbo/RemoteResidentPersonServiceImpl.java index 9fa95e96..8e5a84f4 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/dubbo/RemoteResidentPersonServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/dubbo/RemoteResidentPersonServiceImpl.java @@ -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; + }); + } + } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/listener/ResidentPersonImportListener.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/listener/ResidentPersonImportListener.java index 0231a2cf..93e9ca70 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/listener/ResidentPersonImportListener.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/listener/ResidentPersonImportListener.java @@ -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() + .eq(ResidentPerson::getPhone, phone) + .eq(ResidentPerson::getTenantId, tenantId)); } /** @@ -73,6 +89,9 @@ public class ResidentPersonServiceImpl implements IResidentPersonService { public TableDataInfo queryPageList(ResidentPersonBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page 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 queryList(ResidentPersonBo bo) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); - return baseMapper.selectVoList(lqw); + List residentPersonVos = baseMapper.selectVoList(lqw); + residentPersonVos.forEach(s -> { + s.setPassword(null); + }); + return residentPersonVos; } private LambdaQueryWrapper 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().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 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()); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ResidentUnitServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ResidentUnitServiceImpl.java index 9bd9fa87..e44eca30 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ResidentUnitServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ResidentUnitServiceImpl.java @@ -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()); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServerBookingServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServerBookingServiceImpl.java index 441baa60..14919434 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServerBookingServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServerBookingServiceImpl.java @@ -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; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterRecordServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterRecordServiceImpl.java index bf6a03b9..e43c7040 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterRecordServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterRecordServiceImpl.java @@ -301,6 +301,7 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService { private Map trendMonthData(String floorId, String meterId, Long meterType, String year) { Map resultMap = new HashMap<>(); List> 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 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(); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/tasks/InspectionTasks.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/tasks/InspectionTasks.java index a15a866d..3f47d06e 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/tasks/InspectionTasks.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/tasks/InspectionTasks.java @@ -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 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/tasks/MachineTasks.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/tasks/MachineTasks.java index c3f8b73f..45b12581 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/tasks/MachineTasks.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/tasks/MachineTasks.java @@ -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 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/utils/UploadFaceUtil.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/utils/UploadFaceUtil.java index 7046e48b..38a93128 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/utils/UploadFaceUtil.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/utils/UploadFaceUtil.java @@ -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; diff --git a/ruoyi-modules/Property/src/main/resources/mapper/Property/smartDevicesService/TbMeterReocordMapper.xml b/ruoyi-modules/Property/src/main/resources/mapper/Property/smartDevicesService/TbMeterReocordMapper.xml index b56d55e2..0a3f97ee 100644 --- a/ruoyi-modules/Property/src/main/resources/mapper/Property/smartDevicesService/TbMeterReocordMapper.xml +++ b/ruoyi-modules/Property/src/main/resources/mapper/Property/smartDevicesService/TbMeterReocordMapper.xml @@ -53,8 +53,8 @@ AND a.meter_id = #{meterId} - GROUP BY MONTH(reading_time) - ORDER BY `month`; + GROUP BY `month` + ORDER BY `month`