提交 1a0c5070 编写于 作者: wenhao.qin's avatar wenhao.qin

产品沟通,修改saas端注册逻辑代码

上级 398ca97e
流水线 #43630 已取消 于阶段
// Copyright 2016-2101 Pica.
package com.pica.cloud.account.account.server.service.impl;
import com.alibaba.fastjson.JSON;
import com.pica.cloud.account.account.server.constants.Constants;
import com.pica.cloud.account.account.server.entity.*;
import com.pica.cloud.account.account.server.enums.SaasRoleEnum;
......@@ -29,6 +30,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import springfox.documentation.spring.web.json.Json;
import java.util.*;
import java.util.stream.Collectors;
......@@ -101,9 +103,9 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
//手机号加密
String mobileEncrypt = AESUtil.encryptV0(mobile);
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobileEncrypt);
//密码已经存在的处理逻辑
if (Objects.nonNull(accountInfoEntity) && StringUtils.isNotBlank(accountInfoEntity.getPassword())) {
throw new PicaException(PicaResultCode.PARAM_IS_INVALID.code(), "用户已存在,且密码已设置,不可进行编辑");
Account byMobilePhone = accountMapper.getByMobilePhone(mobileEncrypt);
if ((null == accountInfoEntity && byMobilePhone != null) || (null != accountInfoEntity && byMobilePhone == null)){
logger.error("saas注册,account和doctor存在数据不一致情况, req={}",JSON.toJSONString(req));
}
//用户不存在的处理逻辑
if (accountInfoEntity == null) {
......@@ -122,7 +124,7 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
redisClient.del(nxKey);
return 1;
}
Account byMobilePhone = accountMapper.getByMobilePhone(mobileEncrypt);
//用户存在的处理逻辑 给出提示信息
Integer hospitalId = byMobilePhone.getHospitalId();
Hospital hospital;
if (null == hospitalId || null == (hospital = hospitalMapper.selectByPrimaryKey(hospitalId))){
......@@ -136,20 +138,6 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
PicaResultCode.PARAM_IS_INVALID.code(),
String.format("该手机号已存在于\"%s\"中,如需修改请至云鹊医App中修改所属机构",hospital.getName()));
}
Account account = new Account();
account.setId(byMobilePhone.getId());
account.setModifyId(doctorId);
account.setHospitalId(req.getHospitalId());
account.setHospital(req.getHospitalName());
account.setModifyTime(Calendar.getInstance().getTime());
if (StringUtils.isNotEmpty(req.getComment())) {
account.setComment(req.getComment());
}
accountService.updateAccountById(account);
/** 修改密码 */
if (StringUtils.isNotEmpty(req.getPassword()) && StringUtils.isEmpty(byMobilePhone.getPassword())) {
passwordService.modifyPassword(mobileEncrypt, byMobilePhone.getPassword(), StringUtils.upperCase(MD5Util.MD5(req.getPassword())), true);
}
}
return 1;
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册