|
|
@@ -0,0 +1,45 @@
|
|
|
+package cn.tr.module.smart.common.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.tr.core.exception.ServiceException;
|
|
|
+import cn.tr.core.exception.TRExcCode;
|
|
|
+import cn.tr.core.strategy.LoginUserStrategy;
|
|
|
+import cn.tr.core.utils.PswUtils;
|
|
|
+import cn.tr.module.smart.common.dto.BizAppUserInfoDTO;
|
|
|
+import cn.tr.module.smart.common.service.IDoctorUserService;
|
|
|
+import cn.tr.module.sys.user.vo.DoctorUserHospitalVO;
|
|
|
+import cn.tr.module.sys.user.po.SysUserPO;
|
|
|
+import cn.tr.module.sys.user.repository.SysUserRepository;
|
|
|
+import cn.tr.module.sys.user.repository.SysUserTenantRepository;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+@Service
|
|
|
+public class DoctorUserServiceImpl implements IDoctorUserService {
|
|
|
+ private SysUserRepository userRepository;
|
|
|
+ private SysUserTenantRepository userTenantRepository;
|
|
|
+ @Override
|
|
|
+ public void insertUserInfo(BizAppUserInfoDTO source) {
|
|
|
+ String currentUserId = LoginUserStrategy.tr.getCurrentUserId();
|
|
|
+ SysUserPO sysUserPO = userRepository.selectById(currentUserId);
|
|
|
+ if(ObjectUtil.isNull(sysUserPO)){
|
|
|
+ throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"用户不存在");
|
|
|
+ }
|
|
|
+ if (StrUtil.isNotEmpty(source.getPassword())&&StrUtil.isNotEmpty(sysUserPO.getPassword())){
|
|
|
+ throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"用户已设置完密码,请在用户中心修改密码");
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(source.getPassword())){
|
|
|
+ sysUserPO.setPassword(PswUtils.encryptPassword(source.getPassword()));
|
|
|
+ }
|
|
|
+ sysUserPO.setNickname(source.getNickname());
|
|
|
+ sysUserPO.setAvatar(source.getAvatar());
|
|
|
+ userRepository.updateById(sysUserPO);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<DoctorUserHospitalVO> stdSelectHospitalList(String currentUserId) {
|
|
|
+ return userRepository.stdSelectHospitalList(currentUserId);
|
|
|
+ }
|
|
|
+}
|