|
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.care.common.entity.*;
|
|
import com.care.common.entity.*;
|
|
|
|
|
|
import com.care.common.enums.DeviceActiveStatusEnum;
|
|
import com.care.common.enums.DeviceActiveStatusEnum;
|
|
-import com.care.common.enums.OlderLiveTypeEnum;
|
|
|
|
import com.care.common.enums.UserRoleEnum;
|
|
import com.care.common.enums.UserRoleEnum;
|
|
import com.care.common.enums.ValidStatusEnum;
|
|
import com.care.common.enums.ValidStatusEnum;
|
|
import com.care.common.exception.BDException;
|
|
import com.care.common.exception.BDException;
|
|
@@ -19,7 +18,7 @@ import com.care.common.util.MyBeanUtils;
|
|
import com.care.common.vo.PageReqVO;
|
|
import com.care.common.vo.PageReqVO;
|
|
import com.care.common.vo.UserLogindConvertVO;
|
|
import com.care.common.vo.UserLogindConvertVO;
|
|
import com.care.common.vo.device.DeviceVO;
|
|
import com.care.common.vo.device.DeviceVO;
|
|
-import com.care.common.vo.sysuser.CareSysUserVO;
|
|
|
|
|
|
+import com.care.common.vo.sysuser.SysUserVO;
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -68,6 +67,22 @@ public class BmsSysUserService{
|
|
if (user != null){
|
|
if (user != null){
|
|
CareOrganization org = careOrganizationService.getById(user.getOrgId());
|
|
CareOrganization org = careOrganizationService.getById(user.getOrgId());
|
|
|
|
|
|
|
|
+ if (ValidStatusEnum.INVALID.getValue().equals(org.getValidStatus())) {
|
|
|
|
+ throw new BDException("该用户所属机构已经停用");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Date servStartDate0 = org.getServStartDate();
|
|
|
|
+ Date servEndDate0 = org.getServEndDate();
|
|
|
|
+ Date now = DateUtils.strToDate(DateUtils.getCurrYyyy_MM_ddDate(),"yyyy-MM-dd");
|
|
|
|
+ if(servEndDate0 != null || servEndDate0 != null) {
|
|
|
|
+ if ( now.before(servStartDate0) || now.after(servEndDate0)) {
|
|
|
|
+ throw new BDException("该用户所属机构没在有效期");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (ValidStatusEnum.INVALID.getValue().equals(org.getValidStatus())) {
|
|
|
|
+ throw new BDException("该用户所属机构已经停用");
|
|
|
|
+ }
|
|
|
|
|
|
userLogindConvertVO = new UserLogindConvertVO();
|
|
userLogindConvertVO = new UserLogindConvertVO();
|
|
BeanUtil.copyProperties(user,userLogindConvertVO);
|
|
BeanUtil.copyProperties(user,userLogindConvertVO);
|
|
@@ -79,11 +94,10 @@ public class BmsSysUserService{
|
|
throw new BDException("用户名或密码错误");
|
|
throw new BDException("用户名或密码错误");
|
|
}
|
|
}
|
|
if (ValidStatusEnum.INVALID.getValue().equals(user.getValidStatus())) {
|
|
if (ValidStatusEnum.INVALID.getValue().equals(user.getValidStatus())) {
|
|
- throw new BDException("用户已经禁用");
|
|
|
|
|
|
+ throw new BDException("用户已经停用");
|
|
}
|
|
}
|
|
Date servStartDate = user.getServStartDate();
|
|
Date servStartDate = user.getServStartDate();
|
|
Date servEndDate = user.getServEndDate();
|
|
Date servEndDate = user.getServEndDate();
|
|
- Date now = DateUtils.strToDate(DateUtils.getCurrYyyy_MM_ddDate(),"yyyy-MM-dd");
|
|
|
|
if(servStartDate != null || servEndDate != null) {
|
|
if(servStartDate != null || servEndDate != null) {
|
|
if ( now.before(servStartDate) || now.after(servEndDate)) {
|
|
if ( now.before(servStartDate) || now.after(servEndDate)) {
|
|
throw new BDException("用户没在有效期");
|
|
throw new BDException("用户没在有效期");
|
|
@@ -98,8 +112,8 @@ public class BmsSysUserService{
|
|
* @param stationId
|
|
* @param stationId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public List<CareSysUserVO> queryKeeperListByStationId(Long orgId,Long stationId){
|
|
|
|
- List<CareSysUserVO> datas = new ArrayList<>();
|
|
|
|
|
|
+ public List<SysUserVO> queryKeeperListByStationId(Long orgId, Long stationId){
|
|
|
|
+ List<SysUserVO> datas = new ArrayList<>();
|
|
QueryWrapper<CareSysUser> userQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CareSysUser> userQueryWrapper = new QueryWrapper<>();
|
|
userQueryWrapper.lambda().eq(orgId != null,CareSysUser::getOrgId,orgId).eq(CareSysUser::getStationId,stationId)
|
|
userQueryWrapper.lambda().eq(orgId != null,CareSysUser::getOrgId,orgId).eq(CareSysUser::getStationId,stationId)
|
|
.eq(CareSysUser::getRole, UserRoleEnum.CHANMB.getValue())
|
|
.eq(CareSysUser::getRole, UserRoleEnum.CHANMB.getValue())
|
|
@@ -107,7 +121,7 @@ public class BmsSysUserService{
|
|
List<CareSysUser> users = this.careSysUserService.list(userQueryWrapper);
|
|
List<CareSysUser> users = this.careSysUserService.list(userQueryWrapper);
|
|
if (users != null){
|
|
if (users != null){
|
|
users.forEach(item -> {
|
|
users.forEach(item -> {
|
|
- CareSysUserVO vo = new CareSysUserVO();
|
|
|
|
|
|
+ SysUserVO vo = new SysUserVO();
|
|
BeanUtil.copyProperties(item,vo);
|
|
BeanUtil.copyProperties(item,vo);
|
|
datas.add(vo);
|
|
datas.add(vo);
|
|
});
|
|
});
|
|
@@ -120,7 +134,7 @@ public class BmsSysUserService{
|
|
* @param stationId
|
|
* @param stationId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public IPage<CareSysUserVO> listCareSysUser(String name,String phone, Long stationId,UserLogindConvertVO loginUser, PageReqVO pageReqVo) {
|
|
|
|
|
|
+ public IPage<SysUserVO> listCareSysUser(String name, String phone, Long stationId, UserLogindConvertVO loginUser, PageReqVO pageReqVo) {
|
|
IPage<CareSysUser> page = new Page<>(pageReqVo.getCurrent(), pageReqVo.getPageSize());
|
|
IPage<CareSysUser> page = new Page<>(pageReqVo.getCurrent(), pageReqVo.getPageSize());
|
|
QueryWrapper<CareSysUser> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CareSysUser> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.lambda().like(StrUtil.isNotEmpty(name),CareSysUser::getName,name)
|
|
queryWrapper.lambda().like(StrUtil.isNotEmpty(name),CareSysUser::getName,name)
|
|
@@ -132,11 +146,11 @@ public class BmsSysUserService{
|
|
.orderByAsc(CareSysUser::getName);
|
|
.orderByAsc(CareSysUser::getName);
|
|
|
|
|
|
IPage<CareSysUser> pageRes = this.careSysUserService.page(page, queryWrapper);
|
|
IPage<CareSysUser> pageRes = this.careSysUserService.page(page, queryWrapper);
|
|
- IPage<CareSysUserVO> results = new Page<>(pageRes.getCurrent(),pageRes.getSize(),pageRes.getTotal());
|
|
|
|
|
|
+ IPage<SysUserVO> results = new Page<>(pageRes.getCurrent(),pageRes.getSize(),pageRes.getTotal());
|
|
if(CollUtil.isNotEmpty(pageRes.getRecords())){
|
|
if(CollUtil.isNotEmpty(pageRes.getRecords())){
|
|
- List<CareSysUserVO> list = new ArrayList<>();
|
|
|
|
|
|
+ List<SysUserVO> list = new ArrayList<>();
|
|
pageRes.getRecords().forEach(item -> {
|
|
pageRes.getRecords().forEach(item -> {
|
|
- CareSysUserVO resVO = new CareSysUserVO();
|
|
|
|
|
|
+ SysUserVO resVO = new SysUserVO();
|
|
BeanUtils.copyProperties(item,resVO);
|
|
BeanUtils.copyProperties(item,resVO);
|
|
//服务设备数量
|
|
//服务设备数量
|
|
QueryWrapper<CareDevice> queryWrapper1 = new QueryWrapper<>();
|
|
QueryWrapper<CareDevice> queryWrapper1 = new QueryWrapper<>();
|
|
@@ -185,10 +199,10 @@ public class BmsSysUserService{
|
|
* @param id
|
|
* @param id
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public CareSysUserVO getCareSysUserById(Long id,UserLogindConvertVO loginUser){
|
|
|
|
|
|
+ public SysUserVO getCareSysUserById(Long id, UserLogindConvertVO loginUser){
|
|
CareSysUser careSysUser = this.careSysUserService.getById(id);
|
|
CareSysUser careSysUser = this.careSysUserService.getById(id);
|
|
if (careSysUser!=null){
|
|
if (careSysUser!=null){
|
|
- CareSysUserVO resVO = new CareSysUserVO();
|
|
|
|
|
|
+ SysUserVO resVO = new SysUserVO();
|
|
BeanUtil.copyProperties(careSysUser,resVO);
|
|
BeanUtil.copyProperties(careSysUser,resVO);
|
|
|
|
|
|
//服务设备数量和列表
|
|
//服务设备数量和列表
|
|
@@ -264,7 +278,7 @@ public class BmsSysUserService{
|
|
* @param vo
|
|
* @param vo
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public int createCareSysUser(CareSysUserVO vo,UserLogindConvertVO loginUser){
|
|
|
|
|
|
+ public int createCareSysUser(SysUserVO vo, UserLogindConvertVO loginUser){
|
|
QueryWrapper<CareSysUser> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CareSysUser> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.lambda().eq(CareSysUser::getPhone,vo.getPhone());
|
|
queryWrapper.lambda().eq(CareSysUser::getPhone,vo.getPhone());
|
|
if(careSysUserService.count(queryWrapper) > 0){
|
|
if(careSysUserService.count(queryWrapper) > 0){
|
|
@@ -297,7 +311,7 @@ public class BmsSysUserService{
|
|
* @param vo
|
|
* @param vo
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public void updateCareSysUser(CareSysUserVO vo){
|
|
|
|
|
|
+ public void updateCareSysUser(SysUserVO vo){
|
|
//保存管家
|
|
//保存管家
|
|
CareSysUser careSysUser = this.careSysUserService.getById(vo.getId());
|
|
CareSysUser careSysUser = this.careSysUserService.getById(vo.getId());
|
|
MyBeanUtils.copyProperties(vo,careSysUser);
|
|
MyBeanUtils.copyProperties(vo,careSysUser);
|
|
@@ -344,7 +358,7 @@ public class BmsSysUserService{
|
|
* @param stationName
|
|
* @param stationName
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public IPage<CareSysUserVO> listStationAccount(String stationName,UserLogindConvertVO loginUser, PageReqVO pageReqVo) {
|
|
|
|
|
|
+ public IPage<SysUserVO> listStationAccount(String stationName, UserLogindConvertVO loginUser, PageReqVO pageReqVo) {
|
|
Long stationId = null;
|
|
Long stationId = null;
|
|
|
|
|
|
QueryWrapper<CareStation> queryWrapper0 = new QueryWrapper<>();
|
|
QueryWrapper<CareStation> queryWrapper0 = new QueryWrapper<>();
|
|
@@ -361,11 +375,11 @@ public class BmsSysUserService{
|
|
.orderByAsc(CareSysUser::getName);
|
|
.orderByAsc(CareSysUser::getName);
|
|
|
|
|
|
IPage<CareSysUser> pageRes = this.careSysUserService.page(page, queryWrapper);
|
|
IPage<CareSysUser> pageRes = this.careSysUserService.page(page, queryWrapper);
|
|
- IPage<CareSysUserVO> results = new Page<>(pageRes.getCurrent(),pageRes.getSize(),pageRes.getTotal());
|
|
|
|
|
|
+ IPage<SysUserVO> results = new Page<>(pageRes.getCurrent(),pageRes.getSize(),pageRes.getTotal());
|
|
if(CollUtil.isNotEmpty(pageRes.getRecords())){
|
|
if(CollUtil.isNotEmpty(pageRes.getRecords())){
|
|
- List<CareSysUserVO> list = new ArrayList<>();
|
|
|
|
|
|
+ List<SysUserVO> list = new ArrayList<>();
|
|
pageRes.getRecords().forEach(item -> {
|
|
pageRes.getRecords().forEach(item -> {
|
|
- CareSysUserVO resVO = new CareSysUserVO();
|
|
|
|
|
|
+ SysUserVO resVO = new SysUserVO();
|
|
BeanUtils.copyProperties(item,resVO);
|
|
BeanUtils.copyProperties(item,resVO);
|
|
//服务设备数量
|
|
//服务设备数量
|
|
QueryWrapper<CareDevice> queryWrapper1 = new QueryWrapper<>();
|
|
QueryWrapper<CareDevice> queryWrapper1 = new QueryWrapper<>();
|
|
@@ -386,10 +400,10 @@ public class BmsSysUserService{
|
|
* @param id
|
|
* @param id
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public CareSysUserVO getStationAccountById(Long id){
|
|
|
|
|
|
+ public SysUserVO getStationAccountById(Long id){
|
|
CareSysUser careSysUser = this.careSysUserService.getById(id);
|
|
CareSysUser careSysUser = this.careSysUserService.getById(id);
|
|
if (careSysUser!=null){
|
|
if (careSysUser!=null){
|
|
- CareSysUserVO resVO = new CareSysUserVO();
|
|
|
|
|
|
+ SysUserVO resVO = new SysUserVO();
|
|
BeanUtil.copyProperties(careSysUser,resVO);
|
|
BeanUtil.copyProperties(careSysUser,resVO);
|
|
|
|
|
|
//服务设备列表
|
|
//服务设备列表
|
|
@@ -426,7 +440,7 @@ public class BmsSysUserService{
|
|
* @param vo
|
|
* @param vo
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public int createStationAccount(CareSysUserVO vo,UserLogindConvertVO loginUser){
|
|
|
|
|
|
+ public int createStationAccount(SysUserVO vo, UserLogindConvertVO loginUser){
|
|
QueryWrapper<CareSysUser> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<CareSysUser> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.lambda().eq(CareSysUser::getPhone,vo.getPhone());
|
|
queryWrapper.lambda().eq(CareSysUser::getPhone,vo.getPhone());
|
|
if(careSysUserService.count(queryWrapper) > 0){
|
|
if(careSysUserService.count(queryWrapper) > 0){
|
|
@@ -451,7 +465,7 @@ public class BmsSysUserService{
|
|
* @param vo
|
|
* @param vo
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public void updateStationAccount(CareSysUserVO vo){
|
|
|
|
|
|
+ public void updateStationAccount(SysUserVO vo){
|
|
//保存服务站账号
|
|
//保存服务站账号
|
|
CareSysUser careSysUser = this.careSysUserService.getById(vo.getId());
|
|
CareSysUser careSysUser = this.careSysUserService.getById(vo.getId());
|
|
BeanUtil.copyProperties(vo,careSysUser);
|
|
BeanUtil.copyProperties(vo,careSysUser);
|