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

20191028 优化代码

上级 257213ff
流水线 #16357 已失败 于阶段
in 3 second
......@@ -83,8 +83,8 @@ public class AutoCodeController extends AccountBaseController {
String authCode = CommonUtil.createValidateCode(); //随机生成验证码
String message = "您的验证码是" + authCode + ",在10分钟内有效。如非本人操作,请忽略本短信!";
//判断账号是否已经存在
AccountInfoEntity accountByMobilePhone = accountService.getAccountByMobilePhone(mobilePhone);
long senderId = accountByMobilePhone == null ? 0L : accountByMobilePhone.getId();
Integer accountIdByMobilePhone = accountService.getAccountIdByMobilePhone(mobilePhone);
long senderId = accountIdByMobilePhone == null ? 0L : accountIdByMobilePhone;
//验证码保存到redis,失效时间10分钟
cacheClient.set(this.getAuthCodeKey(mobilePhone, flag), authCode, 600);
logger.info(this.getAuthCodeKey(mobilePhone, flag));
......@@ -149,8 +149,8 @@ public class AutoCodeController extends AccountBaseController {
private void processSendAuthCode(String mobilePhone, Integer flag, String authCodeKeySecure) {
String authCode = CommonUtil.createValidateCode();
String message = "您的验证码是" + authCode + ",在10分钟内有效。如非本人操作,请忽略本短信!";
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobilePhone);
long senderId = accountInfoEntity == null ? 0L : accountInfoEntity.getId();
Integer accountIdByMobilePhone = accountService.getAccountIdByMobilePhone(mobilePhone);
long senderId = accountIdByMobilePhone == null ? 0L : accountIdByMobilePhone;
cacheClient.set(this.getAuthCodeKey(mobilePhone, flag.toString()), authCode, 600);
logger.info("验证码缓存信息----->:"+this.getAuthCodeKey(mobilePhone, flag.toString()));
cacheClient.set(authCodeKeySecure, System.currentTimeMillis(), 60);
......
......@@ -13,6 +13,15 @@ public interface AccountInfoDetailMapper {
AccountInfoEntity selectByMobile(String mobile);
/**
* 通过电话号码查询账号id
*
* @param mobile
* @return
*/
Integer selectAcctIdByMobile(String mobile);
/**
* 插入注册人信息
*
......
package com.pica.cloud.account.account.server.service;
import ch.qos.logback.core.rolling.helper.IntegerTokenConverter;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
......@@ -32,4 +33,6 @@ public interface AccountService {
AccountInfoEntity getAccountByMobilePhone(String mobilePhone);
Integer getAccountIdByMobilePhone(String mobilePhone);
}
......@@ -64,6 +64,12 @@ public class AccountServiceImpl implements AccountService {
return accountInfoDetailMapper.selectByMobile(encryptMobilePhone);
}
@Override
public Integer getAccountIdByMobilePhone(String mobilePhone) {
String encryptMobilePhone = EncryptUtils.encryptContent(mobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE);
return accountInfoDetailMapper.selectAcctIdByMobile(encryptMobilePhone);
}
//根据微信unionid获取账号
public Account getByUnionid(String unionid) {
return accountMapper.getByUnionid(unionid);
......
......@@ -57,13 +57,13 @@ public class DoctorServiceImpl implements DoctorService {
doctorMapper.updateByPrimaryKeySelective(doctor);
}
@Transactional
@Transactional()
@Override
public void deleteDoctorInfo(Integer id) {
//p_doctor表修改记录状态
doctorMapper.updateDeleteByPrimaryKey(id);
Doctor doctor = doctorMapper.selectByPrimaryKey(id);
Integer acctId = doctor.getAcctId();
doctorMapper.updateDeleteByPrimaryKey(id);
accountInfoDetailMapper.updateDeleteByPrimaryKey(acctId);
}
......
......@@ -168,7 +168,7 @@ public class AESUtil {
public static void main(String[] args) throws Exception {
String KEY="zJJ$c5md3$yuuhWW";
System.out.println("-------------加密---------");
String content = "13693714485";
String content = "13024112588";
System.out.println("加密前:" + content);
System.out.println("加密密钥和解密密钥:" + KEY);
......
......@@ -38,6 +38,13 @@
where mobile_phone = #{mobile} and delete_flag=1
</select>
<!--通过电话号码查询账号信息-->
<select id="selectAcctIdByMobile" resultMap="java.lang.Integer" parameterType="java.lang.String">
select id
from account_info
where mobile_phone = #{mobile} and delete_flag=1
</select>
<!--插入注册人信息-->
<update id="updateCreateInfo" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info set created_id=#{acctId}, modified_id=#{acctId} where id=#{acctId}
......
......@@ -103,7 +103,7 @@
select
<include refid="Base_Column_List"/>
from p_doctor
where id = #{id,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER} and delete_flag=1
</select>
<!--删除用户-->
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册