refactor(property):
- TbMeterInfoServiceImpl 中模拟 token 上下文 - resident服务分包
This commit is contained in:
@@ -27,7 +27,7 @@ import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
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.property.service.residentService.IResidentPersonService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
@@ -19,7 +19,7 @@ import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
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.property.service.residentService.IResidentUnitService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
|
@@ -18,7 +18,7 @@ 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.dromara.property.service.residentService.IResidentPersonService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@@ -11,7 +11,7 @@ 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 org.dromara.property.service.residentService.IResidentPersonService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@@ -19,8 +19,8 @@ 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 org.dromara.property.service.residentService.IResidentPersonService;
|
||||
import org.dromara.property.service.residentService.IResidentUnitService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package org.dromara.property.service.impl;
|
||||
package org.dromara.property.service.impl.residentImpl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.BCrypt;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@@ -13,7 +14,7 @@ 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.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.service.IResidentUnitService;
|
||||
import org.dromara.property.service.residentService.IResidentUnitService;
|
||||
import org.dromara.sis.api.RemoteSisAuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@@ -22,7 +23,7 @@ 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.dromara.property.service.residentService.IResidentPersonService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -147,7 +148,11 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
// 首次入驻新用户权限组默认使用公司权限
|
||||
ResidentUnitVo ruVo = residentUnitService.queryById(bo.getUnitId());
|
||||
// 密码加密,不存明文密码
|
||||
add.setPassword(BCrypt.hashpw("123456"));
|
||||
if (Objects.equals(add.getPassword(), "") || add.getPassword() == null){
|
||||
add.setPassword(BCrypt.hashpw("123456"));
|
||||
}else {
|
||||
add.setPassword(BCrypt.hashpw(add.getPassword()));
|
||||
}
|
||||
//查询该单位下是否有管理员
|
||||
new LambdaQueryWrapper<ResidentPerson>().eq(ResidentPerson::getUnitId, bo.getUnitId())
|
||||
.eq(ResidentPerson::getUserRoles, 1);
|
@@ -1,4 +1,4 @@
|
||||
package org.dromara.property.service.impl;
|
||||
package org.dromara.property.service.impl.residentImpl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.crypto.digest.BCrypt;
|
||||
@@ -13,14 +13,14 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.residentService.IResidentPersonService;
|
||||
import org.dromara.property.service.ITbRoomService;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.dromara.property.service.residentService.IResidentUnitService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl.smartDevicesImpl;
|
||||
|
||||
import cn.dev33.satoken.context.mock.SaTokenContextMockUtil;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
@@ -335,7 +336,9 @@ public class TbMeterInfoServiceImpl implements ITbMeterInfoService {
|
||||
private void handleMeterCommunicationFailure(LoginUser user, JSONObject jsonObject, List<TbMeterInfoVo> meterInfoVoList, String tokenValue) {
|
||||
meterInfoVoList.forEach(item -> item.setCommunicationState(0L));
|
||||
jsonObject.put("data", meterInfoVoList);
|
||||
remoteMessageService.sendMessage(user.getUserId(), tokenValue, jsonObject.toString());
|
||||
SaTokenContextMockUtil.setMockContext(() -> {
|
||||
remoteMessageService.sendMessage(user.getUserId(), tokenValue, jsonObject.toString());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -377,6 +380,8 @@ public class TbMeterInfoServiceImpl implements ITbMeterInfoService {
|
||||
}
|
||||
|
||||
jsonObject.put("data", meterInfoVoList);
|
||||
remoteMessageService.sendMessage(user.getUserId(), tokenValue, jsonObject.toString());
|
||||
SaTokenContextMockUtil.setMockContext(() -> {
|
||||
remoteMessageService.sendMessage(user.getUserId(), tokenValue, jsonObject.toString());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package org.dromara.property.service;
|
||||
package org.dromara.property.service.residentService;
|
||||
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentPersonBo;
|
@@ -1,4 +1,4 @@
|
||||
package org.dromara.property.service;
|
||||
package org.dromara.property.service.residentService;
|
||||
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.domain.bo.residentBo.ResidentUnitBo;
|
@@ -6,7 +6,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
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.property.service.residentService.IResidentPersonService;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
Reference in New Issue
Block a user