提交 dfe1eeaf 编写于 作者: rushui.chen's avatar rushui.chen

20200116 手机号变更记录表

流水线 #20894 已失败 于阶段
in 0 second
...@@ -87,6 +87,7 @@ public class AutoCodeController extends AccountBaseController { ...@@ -87,6 +87,7 @@ public class AutoCodeController extends AccountBaseController {
long senderId = accountIdByMobilePhone == null ? 0L : accountIdByMobilePhone; long senderId = accountIdByMobilePhone == null ? 0L : accountIdByMobilePhone;
//验证码保存到redis,失效时间10分钟 //验证码保存到redis,失效时间10分钟
cacheClient.set(this.getAuthCodeKey(mobilePhone, flag), authCode, 600); cacheClient.set(this.getAuthCodeKey(mobilePhone, flag), authCode, 600);
//处理验证码原子性的问题
cacheClient.set(RegisterCodeKeyUtils.getRegisterKey(mobilePhone,authCode), 100, 600); cacheClient.set(RegisterCodeKeyUtils.getRegisterKey(mobilePhone,authCode), 100, 600);
logger.info(this.getAuthCodeKey(mobilePhone, flag)); logger.info(this.getAuthCodeKey(mobilePhone, flag));
//发送短信 //发送短信
......
...@@ -45,14 +45,17 @@ public class ModifyMobileController extends AccountBaseController { ...@@ -45,14 +45,17 @@ public class ModifyMobileController extends AccountBaseController {
public PicaResponse modifyMobile(@RequestBody EncryptEntity entity) throws Exception { public PicaResponse modifyMobile(@RequestBody EncryptEntity entity) throws Exception {
Long doctorId = super.getDoctorIdByToken(); Long doctorId = super.getDoctorIdByToken();
Doctor doctorInfo = doctorService.getDoctorInfo(doctorId.intValue()); Doctor doctorInfo = doctorService.getDoctorInfo(doctorId.intValue());
//旧的手机号
String mobilePhone = doctorInfo.getMobilePhone(); String mobilePhone = doctorInfo.getMobilePhone();
Integer acctId = modifyMobileService.getAcctIdByMobile(mobilePhone); Integer acctId = modifyMobileService.getAcctIdByMobile(mobilePhone);
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class); BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
//新的手机号
String mobile = request.getMobile(); String mobile = request.getMobile();
accountUtils.checkMobilePhoneAndAuthCode(mobile, AccountTypeEnum.SYSCODE_TYPE_MODIFY_MOBILE.getCode() + "", request.getAuthCode()); accountUtils.checkMobilePhoneAndAuthCode(mobile, AccountTypeEnum.SYSCODE_TYPE_MODIFY_MOBILE.getCode() + "", request.getAuthCode());
//判断当前手机号是否已经注册过 //判断当前手机号是否已经注册过
AccountInfoEntity accountInfoEntity = accountService.getAccountByMobilePhone(mobile); AccountInfoEntity accountInfoEntity = accountService.getAccountByMobilePhone(mobile);
if (accountInfoEntity == null) { if (accountInfoEntity == null) {
modifyMobileService.recodeMobileModify(acctId,mobilePhone,mobile);
modifyMobileService.modify(acctId, mobile); modifyMobileService.modify(acctId, mobile);
return PicaResponse.toResponse(); return PicaResponse.toResponse();
} else { } else {
......
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class LogMobileModify {
private Integer id;
private Integer acctId;
private String mobilePhoneNew;
private String mobilePhoneOld;
private Date modifiedTime;
private Integer modifiedId;
private Integer deleteFlag;
private Integer createdId;
private Date createdTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public String getMobilePhoneNew() {
return mobilePhoneNew;
}
public void setMobilePhoneNew(String mobilePhoneNew) {
this.mobilePhoneNew = mobilePhoneNew == null ? null : mobilePhoneNew.trim();
}
public String getMobilePhoneOld() {
return mobilePhoneOld;
}
public void setMobilePhoneOld(String mobilePhoneOld) {
this.mobilePhoneOld = mobilePhoneOld == null ? null : mobilePhoneOld.trim();
}
public Date getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime;
}
public Integer getModifiedId() {
return modifiedId;
}
public void setModifiedId(Integer modifiedId) {
this.modifiedId = modifiedId;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatedId() {
return createdId;
}
public void setCreatedId(Integer createdId) {
this.createdId = createdId;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
}
\ No newline at end of file
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.LogMobileModify;
public interface LogMobileModifyMapper {
int deleteByPrimaryKey(Integer id);
int insert(LogMobileModify record);
int insertSelective(LogMobileModify record);
LogMobileModify selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(LogMobileModify record);
int updateByPrimaryKey(LogMobileModify record);
}
\ No newline at end of file
...@@ -13,4 +13,14 @@ public interface ModifyMobileService { ...@@ -13,4 +13,14 @@ public interface ModifyMobileService {
Integer getAcctIdByMobile(String phone); Integer getAcctIdByMobile(String phone);
/**
* 记录手机号的变更记录
* @param acctId
* @param mobilePhone
* @param mobile
*/
void recodeMobileModify(Integer acctId, String mobilePhone, String mobile);
} }
...@@ -307,7 +307,7 @@ public class LoginServiceImpl implements LoginService { ...@@ -307,7 +307,7 @@ public class LoginServiceImpl implements LoginService {
* @param unionId * @param unionId
*/ */
private void processAccountUnion(Integer acctId, String unionId,Integer productType) { private void processAccountUnion(Integer acctId, String unionId,Integer productType) {
//先查询当前产品线是否有记录?如果有就更新成delete_flag=2; 然后在插入 //先查询当前产品线是否有记录?如果有就更新成delete_flag=2; 然后在插入新的绑定记录
AccountUnionEntity accountUnionResult = accountUnionMapper.selectByUnionId(unionId); AccountUnionEntity accountUnionResult = accountUnionMapper.selectByUnionId(unionId);
if (accountUnionResult!=null){ if (accountUnionResult!=null){
accountUnionMapper.updateUnionStatus(unionId); accountUnionMapper.updateUnionStatus(unionId);
...@@ -316,7 +316,7 @@ public class LoginServiceImpl implements LoginService { ...@@ -316,7 +316,7 @@ public class LoginServiceImpl implements LoginService {
accountUnionEntity.setAcctId(acctId.longValue()); accountUnionEntity.setAcctId(acctId.longValue());
accountUnionEntity.setDeleteFlag(1); accountUnionEntity.setDeleteFlag(1);
accountUnionEntity.setUnionId(unionId); accountUnionEntity.setUnionId(unionId);
accountUnionEntity.setCreatedTime(new Date()) accountUnionEntity.setCreatedTime(new Date());
accountUnionEntity.setModifiedTime(new Date()); accountUnionEntity.setModifiedTime(new Date());
accountUnionEntity.setCreatedId(acctId); accountUnionEntity.setCreatedId(acctId);
accountUnionEntity.setModifiedId(acctId); accountUnionEntity.setModifiedId(acctId);
......
...@@ -2,10 +2,12 @@ package com.pica.cloud.account.account.server.service.impl; ...@@ -2,10 +2,12 @@ package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity; import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.Doctor; import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.entity.LogMobileModify;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum; import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.exception.AccountException; import com.pica.cloud.account.account.server.exception.AccountException;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper; 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.mapper.LogMobileModifyMapper;
import com.pica.cloud.account.account.server.service.ModifyMobileService; import com.pica.cloud.account.account.server.service.ModifyMobileService;
import com.pica.cloud.account.account.server.util.AESUtil; import com.pica.cloud.account.account.server.util.AESUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -25,6 +27,9 @@ public class ModifyMobileServiceImpl implements ModifyMobileService { ...@@ -25,6 +27,9 @@ public class ModifyMobileServiceImpl implements ModifyMobileService {
@Autowired @Autowired
private DoctorMapper doctorMapper; private DoctorMapper doctorMapper;
@Autowired
private LogMobileModifyMapper logMobileModifyMapper;
@Value("${doubleWritingMode}") @Value("${doubleWritingMode}")
private boolean doubleWritingMode; private boolean doubleWritingMode;
...@@ -64,4 +69,26 @@ public class ModifyMobileServiceImpl implements ModifyMobileService { ...@@ -64,4 +69,26 @@ public class ModifyMobileServiceImpl implements ModifyMobileService {
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(phone); AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(phone);
return accountInfoEntity.getId(); return accountInfoEntity.getId();
} }
/**
* 记录账号对应的手机号的变更信息
*
* @param acctId
* @param mobilePhone
* @param mobile
*/
@Override
public void recodeMobileModify(Integer acctId, String mobilePhone, String mobile) {
Date date = new Date();
LogMobileModify logMobileModify = new LogMobileModify();
logMobileModify.setAcctId(acctId);
logMobileModify.setDeleteFlag(1);
logMobileModify.setCreatedId(acctId);
logMobileModify.setCreatedTime(date);
logMobileModify.setModifiedId(acctId);
logMobileModify.setModifiedTime(date);
logMobileModify.setMobilePhoneNew(mobile);
logMobileModify.setMobilePhoneOld(mobilePhone);
logMobileModifyMapper.insert(logMobileModify);
}
} }
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.LogMobileModifyMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.LogMobileModify" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="acct_id" property="acctId" jdbcType="INTEGER" />
<result column="mobile_phone_new" property="mobilePhoneNew" jdbcType="VARCHAR" />
<result column="mobile_phone_old" property="mobilePhoneOld" jdbcType="VARCHAR" />
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP" />
<result column="modified_id" property="modifiedId" jdbcType="INTEGER" />
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER" />
<result column="created_id" property="createdId" jdbcType="INTEGER" />
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, acct_id, mobile_phone_new, mobile_phone_old, modified_time, modified_id, delete_flag,
created_id, created_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from log_mobile_modify
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from log_mobile_modify
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.LogMobileModify" >
insert into log_mobile_modify (id, acct_id, mobile_phone_new,
mobile_phone_old, modified_time, modified_id,
delete_flag, created_id, created_time
)
values (#{id,jdbcType=INTEGER}, #{acctId,jdbcType=INTEGER}, #{mobilePhoneNew,jdbcType=VARCHAR},
#{mobilePhoneOld,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=INTEGER},
#{deleteFlag,jdbcType=INTEGER}, #{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.LogMobileModify" >
insert into log_mobile_modify
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="acctId != null" >
acct_id,
</if>
<if test="mobilePhoneNew != null" >
mobile_phone_new,
</if>
<if test="mobilePhoneOld != null" >
mobile_phone_old,
</if>
<if test="modifiedTime != null" >
modified_time,
</if>
<if test="modifiedId != null" >
modified_id,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
<if test="createdId != null" >
created_id,
</if>
<if test="createdTime != null" >
created_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="acctId != null" >
#{acctId,jdbcType=INTEGER},
</if>
<if test="mobilePhoneNew != null" >
#{mobilePhoneNew,jdbcType=VARCHAR},
</if>
<if test="mobilePhoneOld != null" >
#{mobilePhoneOld,jdbcType=VARCHAR},
</if>
<if test="modifiedTime != null" >
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
#{modifiedId,jdbcType=INTEGER},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null" >
#{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
#{createdTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.LogMobileModify" >
update log_mobile_modify
<set >
<if test="acctId != null" >
acct_id = #{acctId,jdbcType=INTEGER},
</if>
<if test="mobilePhoneNew != null" >
mobile_phone_new = #{mobilePhoneNew,jdbcType=VARCHAR},
</if>
<if test="mobilePhoneOld != null" >
mobile_phone_old = #{mobilePhoneOld,jdbcType=VARCHAR},
</if>
<if test="modifiedTime != null" >
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null" >
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.LogMobileModify" >
update log_mobile_modify
set acct_id = #{acctId,jdbcType=INTEGER},
mobile_phone_new = #{mobilePhoneNew,jdbcType=VARCHAR},
mobile_phone_old = #{mobilePhoneOld,jdbcType=VARCHAR},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=INTEGER},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
created_id = #{createdId,jdbcType=INTEGER},
created_time = #{createdTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册