提交 bc2ea8e8 编写于 作者: dong.an's avatar dong.an

账户中台

...@@ -48,15 +48,6 @@ public class DoctorController extends AccountBaseController { ...@@ -48,15 +48,6 @@ public class DoctorController extends AccountBaseController {
@ApiOperation("修改医生信息接口") @ApiOperation("修改医生信息接口")
@PutMapping(value = "/info", produces = "application/json;charset=utf-8") @PutMapping(value = "/info", produces = "application/json;charset=utf-8")
public PicaResponse modifyDoctorInfo(@RequestBody Doctor doctor) { public PicaResponse modifyDoctorInfo(@RequestBody Doctor doctor) {
AccountUser accountUser = null;
try {
accountUser = super.getAccountUser();
} catch (Exception e) {
e.printStackTrace();
throw new AccountException(AccountExceptionEnum.PICA_LOGIN_AGAIN);
}
Integer userId = accountUser.getId();
doctor.setId(userId);
doctorService.modifyDoctorInfo(doctor); doctorService.modifyDoctorInfo(doctor);
return PicaResponse.toResponse(); return PicaResponse.toResponse();
} }
...@@ -73,8 +64,8 @@ public class DoctorController extends AccountBaseController { ...@@ -73,8 +64,8 @@ public class DoctorController extends AccountBaseController {
if (doctor != null && doctor.getMobilePhone() != null) { if (doctor != null && doctor.getMobilePhone() != null) {
AccountUtils.checkMobilePhone(doctor.getMobilePhone()); AccountUtils.checkMobilePhone(doctor.getMobilePhone());
AccountUtils.checkPassword(doctor.getPassword()); AccountUtils.checkPassword(doctor.getPassword());
doctorService.addDoctorInfo(doctor); Integer userId = doctorService.addDoctorInfo(doctor);
return PicaResponse.toResponse(); return PicaResponse.toResponse(userId);
} else { } else {
throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR); throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR);
} }
......
...@@ -23,7 +23,8 @@ public enum AccountExceptionEnum { ...@@ -23,7 +23,8 @@ public enum AccountExceptionEnum {
PICA_UNBIND_MOBILE("216515", "该手机号未绑定微信"), PICA_UNBIND_MOBILE("216515", "该手机号未绑定微信"),
PICA_MOBILE_SAME("216516", "新手机号与旧手机号不能相同"), PICA_MOBILE_SAME("216516", "新手机号与旧手机号不能相同"),
PICA_PARAMS_ERROR("216517", "传递参数有误"), PICA_PARAMS_ERROR("216517", "传递参数有误"),
PICA_SYSCODE_RETRY("216518", "请X秒后重试"); PICA_SYSCODE_RETRY("216518", "请X秒后重试"),
PICA_NOT_EXIST("216519", "该用户不存在");
private String code; private String code;
......
...@@ -29,7 +29,7 @@ public interface DoctorService { ...@@ -29,7 +29,7 @@ public interface DoctorService {
* *
* @param doctor 新的医生数据 * @param doctor 新的医生数据
*/ */
void addDoctorInfo(Doctor doctor); Integer addDoctorInfo(Doctor doctor);
/** /**
* doctor绑定微信 * doctor绑定微信
......
...@@ -8,6 +8,8 @@ import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper; ...@@ -8,6 +8,8 @@ import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.mapper.DoctorMapper; import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.account.account.server.service.DoctorService; import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.util.AESUtil; import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -35,8 +37,21 @@ public class DoctorServiceImpl implements DoctorService { ...@@ -35,8 +37,21 @@ public class DoctorServiceImpl implements DoctorService {
@Override @Override
public void modifyDoctorInfo(Doctor doctor) { public void modifyDoctorInfo(Doctor doctor) {
Integer id = doctor.getId();
if (id==null){
throw new AccountException(AccountExceptionEnum.PICA_PARAMS_ERROR);
}
Doctor entity = doctorMapper.selectByPrimaryKey(id);
if (entity==null){
throw new AccountException(AccountExceptionEnum.PICA_NOT_EXIST);
}
String mobilePhone = doctor.getMobilePhone();
if (!StringUtils.isBlank(mobilePhone)){
AccountUtils.checkMobilePhone(doctor.getMobilePhone());
}
doctor.setMobilePhone(AESUtil.encryptV0(mobilePhone));
doctor.setModifyTime(new Date()); doctor.setModifyTime(new Date());
doctorMapper.insertSelective(doctor); doctorMapper.updateByPrimaryKeySelective(doctor);
} }
/** /**
...@@ -50,7 +65,7 @@ public class DoctorServiceImpl implements DoctorService { ...@@ -50,7 +65,7 @@ public class DoctorServiceImpl implements DoctorService {
*/ */
@Override @Override
@Transactional @Transactional
public void addDoctorInfo(Doctor doctor) { public Integer addDoctorInfo(Doctor doctor) {
String mobilePhone = doctor.getMobilePhone(); String mobilePhone = doctor.getMobilePhone();
String mobileEncrypt = AESUtil.encryptV0(mobilePhone); String mobileEncrypt = AESUtil.encryptV0(mobilePhone);
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobileEncrypt); AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobileEncrypt);
...@@ -84,6 +99,7 @@ public class DoctorServiceImpl implements DoctorService { ...@@ -84,6 +99,7 @@ public class DoctorServiceImpl implements DoctorService {
doctor.setModifyTime(new Date()); doctor.setModifyTime(new Date());
doctor.setDeleteFlag(1); doctor.setDeleteFlag(1);
doctorMapper.insertSelective(doctor); doctorMapper.insertSelective(doctor);
return doctor.getId();
} }
@Override @Override
......
...@@ -189,7 +189,8 @@ public class LoginServiceImpl implements LoginService { ...@@ -189,7 +189,8 @@ public class LoginServiceImpl implements LoginService {
account.setId(userId); account.setId(userId);
account.setAcctId(acctId.intValue()); account.setAcctId(acctId.intValue());
account.setCreatTime(new Date()); account.setCreatTime(new Date());
account.setMobilePhone(request.getMobile()); //account.setMobilePhone(request.getMobile());
account.setMobilePhone("");
account.setRegisterSource(request.getSourceType()); account.setRegisterSource(request.getSourceType());
String newToken = tokenUtils.generateToken(account); String newToken = tokenUtils.generateToken(account);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
......
...@@ -364,7 +364,7 @@ ...@@ -364,7 +364,7 @@
#{birthday,jdbcType=DATE}, #{showFlag,jdbcType=INTEGER}, #{acctId,jdbcType=INTEGER} #{birthday,jdbcType=DATE}, #{showFlag,jdbcType=INTEGER}, #{acctId,jdbcType=INTEGER}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.Doctor"> <insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.Doctor" useGeneratedKeys="true" keyProperty="id">
insert into p_doctor insert into p_doctor
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册