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

20190829 忘记密码与修改密码功能

上级 3a50f4e0
流水线 #13795 已失败 于阶段
in 1 second
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.configuration.PropertiesConfiguration;
import com.pica.cloud.account.account.server.constants.Constants;
import com.pica.cloud.account.account.server.entity.AccountUser;
import com.pica.cloud.account.account.server.enums.ExceptionType;
import com.pica.cloud.account.account.server.util.PICAPSendMsgModel;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResultCode;
......@@ -19,6 +20,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
......@@ -129,20 +131,62 @@ public abstract class AccountBaseController extends BaseController {
}
}
public int getProductType() {
return 0;
/**
* 账户信息
*
* @return
*/
public AccountUser getAccountUser() {
//无论是否登录,当前对象都应该存在
//把所有请求头信息都封装到当前模型中
String token = this.getToken();
AccountUser accountUser = super.getRedisClient().getToken(token, AccountUser.class);
accountUser.setLoginFrom(this.getSourceType());
accountUser.setLoginPlatform(this.getProductType());
accountUser.setLoginIp(super.getIpAddr());
return accountUser;
}
/**
* 获取账户id
*
* @return
*/
public Integer getAcctId() {
try {
AccountUser accountUser = getAccountUser();
return accountUser.getAcctId();
} catch (Exception e) {
e.printStackTrace();
throw new PicaException(ExceptionType.PICA_LOGIN_AGAIN.getCode(), ExceptionType.PICA_LOGIN_AGAIN.getMessage());
}
}
public int getSourceType() {
return 0;
/**
* 产品线类型:productType: 1.云鹊医(默认值) 2云鹊健康
*
* @return
*/
public Integer getProductType() {
HttpServletRequest request = super.getRequest();
String str = request.getHeader("productType");
if (StringUtils.isNotEmpty(str)) {
return Integer.parseInt(str);
}
return null;
}
/**
* 账户信息
* 终端来源 sourceType:1.android 2.ios 3.web 4.wechat(例如微信小程序) 5.h5
*
* @return
*/
protected AccountUser getAccountUser() {
return new AccountUser();
public Integer getSourceType() {
HttpServletRequest request = super.getRequest();
String str = request.getHeader("sourceType");
if (StringUtils.isNotEmpty(str)) {
return Integer.parseInt(str);
}
return null;
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.AccountUser;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.enums.EnumsType;
import com.pica.cloud.account.account.server.enums.ExceptionType;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.ModifyMobileService;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.sun.javafx.scene.control.skin.TableHeaderRow;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@Api("修改手机号资源")
@RestController
public class ModifyMobileController {
public class ModifyMobileController extends AccountBaseController {
@Autowired
private AccountUtils accountUtils;
@Autowired
private ModifyMobileService modifyMobileService;
@ApiOperation("修改手机号")
@PostMapping("/mobile/modify")
public PicaResponse modifyMobile(@RequestBody EncryptEntity entity) throws Exception {
Integer acctId = null;
try {
AccountUser accountUser = super.getAccountUser();
acctId = accountUser.getAcctId();
} catch (Exception e) {
e.printStackTrace();
throw new PicaException(ExceptionType.PICA_LOGIN_AGAIN.getCode(), ExceptionType.PICA_LOGIN_AGAIN.getMessage());
}
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
String mobile = request.getMobile();
accountUtils.checkMobilePhone(mobile);
accountUtils.checkAuthCode(mobile, EnumsType.SYSCODE_TYPE_MODIFY_MOBILE.getCode() + "", request.getSysCode());
modifyMobileService.modify(acctId, mobile);
return PicaResponse.toResponse("修改成功");
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.AccountUser;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.enums.EnumsType;
import com.pica.cloud.account.account.server.enums.ExceptionType;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.PasswordService;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api("密码资源")
@RestController
@RequestMapping("/password")
public class PasswordController extends AccountBaseController {
@Autowired
private PasswordService passwordService;
@Autowired
private AccountUtils accountUtils;
/**
* 修改密码
*
* @return
*/
@ApiOperation("修改密码接口")
@PostMapping(value = "/modify")
public PicaResponse modifyPassword(@RequestBody EncryptEntity entity) throws Exception {
Integer acctId = super.getAcctId();
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
String oldPwd = request.getOldPwd();
String password = request.getPassword();
if (!StringUtils.isEmpty(password) && !StringUtils.isEmpty(oldPwd)) {
if (!password.equals(oldPwd)) {
passwordService.modifyPassword(acctId, oldPwd, password);
return PicaResponse.toResponse();
} else {
throw new PicaException(ExceptionType.PICA_PASSWORD_EQUAL.getCode(), ExceptionType.PICA_PASSWORD_EQUAL.getMessage());
}
} else {
throw new PicaException(ExceptionType.PICA_PASSWORD_NULL.getCode(), ExceptionType.PICA_PASSWORD_NULL.getMessage());
}
}
/**
* 忘记密码
*
* @return
*/
@ApiOperation("忘记密码接口")
@PostMapping(value = "/reset")
public PicaResponse forgetPassword(@RequestBody EncryptEntity entity) throws Exception {
Integer acctId = super.getAcctId();
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
accountUtils.checkMobilePhone(request.getMobile());
accountUtils.checkAuthCode(request.getMobile(), EnumsType.SYSCODE_TYPE_RESET_PASSWORD.getCode() + "", request.getSysCode());
if (StringUtils.isEmpty(request.getPassword())) {
throw new PicaException(ExceptionType.PICA_PASSWORD_ERROR.getCode(), ExceptionType.PICA_PASSWORD_ERROR.getMessage());
}
request.setAccId(acctId);
passwordService.forgetPassword(request);
return PicaResponse.toResponse();
}
}
......@@ -4,7 +4,16 @@ import com.pica.cloud.foundation.utils.entity.PicaUser;
public class AccountUser extends PicaUser {
//账户id
private Integer acctId;
//渠道来源
private Integer loginFrom;
//平台来源
private Integer loginPlatform;
//账户名
private String acctName;
//登录ip
private String loginIp;
public Integer getAcctId() {
return acctId;
......@@ -13,6 +22,38 @@ public class AccountUser extends PicaUser {
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public Integer getLoginFrom() {
return loginFrom;
}
public void setLoginFrom(Integer loginFrom) {
this.loginFrom = loginFrom;
}
public Integer getLoginPlatform() {
return loginPlatform;
}
public void setLoginPlatform(Integer loginPlatform) {
this.loginPlatform = loginPlatform;
}
public String getAcctName() {
return acctName;
}
public void setAcctName(String acctName) {
this.acctName = acctName;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
}
......@@ -12,7 +12,10 @@ public enum ExceptionType {
PICA_NOT_REGISTER("216508", "未注册,请先注册"),
PICA_PASSWORD_ERROR("216509", "请输入正确的密码"),
PICA_IMAGE_PASSWORD_ERROR("216511", "图形验证码错误"),
PICA_LOGIN_AGAIN("216512", "请重新登录");
PICA_LOGIN_AGAIN("216512", "请重新登录"),
PICA_PASSWORD_NULL("216513", "密码不能为空"),
PICA_PASSWORD_EQUAL("216514", "旧密码与新密码不能相同");
private String code;
private String message;
......
......@@ -4,12 +4,6 @@ package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
public interface AccountInfoDetailMapper {
int deleteByPrimaryKey(Integer id);
int insert(AccountInfoEntity record);
int insertSelective(AccountInfoEntity record);
/**
* 通过电话号码查询账号信息
*
......@@ -27,11 +21,32 @@ public interface AccountInfoDetailMapper {
void updateCreateInfo(int acctId);
/**
* 修改手机号
*
* @param record
* @return
*/
void updateMobileByPrimaryKey(AccountInfoEntity record);
AccountInfoEntity selectByPrimaryKey(Integer id);
/**
* 修改用户密码
*
* @param record
* @return
*/
void updatePasswordByPrimaryKey(AccountInfoEntity record);
AccountInfoEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AccountInfoEntity record);
int updateByPrimaryKey(AccountInfoEntity record);
}
\ No newline at end of file
int deleteByPrimaryKey(Integer id);
int insert(AccountInfoEntity record);
int insertSelective(AccountInfoEntity record);
}
......@@ -10,8 +10,21 @@ public interface AccountUserInfoMapper {
int insertSelective(AccountUserInfoEntity record);
/**
* 通过用户id查询用户信息
* @param id
* @return
*/
AccountUserInfoEntity selectByPrimaryKey(Integer id);
/**
* 通过账户id查询用户信息
*
* @param acctId
* @return
*/
AccountUserInfoEntity selectByAcctId(Integer acctId);
int updateByPrimaryKeySelective(AccountUserInfoEntity record);
int updateByPrimaryKey(AccountUserInfoEntity record);
......
......@@ -5,9 +5,12 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel
public class BaseRequest {
@ApiModelProperty("账户id")
private Integer accId;
private String mobile;
private String password;
@ApiModelProperty("旧密码")
private String oldPwd;
private String sysCode;
private int flag;
@ApiModelProperty("产品线类型")
......@@ -17,6 +20,13 @@ public class BaseRequest {
@ApiModelProperty("登录ip")
private String loginIp;
public Integer getAccId() {
return accId;
}
public void setAccId(Integer accId) {
this.accId = accId;
}
public String getMobile() {
return mobile;
......@@ -34,6 +44,14 @@ public class BaseRequest {
this.password = password;
}
public String getOldPwd() {
return oldPwd;
}
public void setOldPwd(String oldPwd) {
this.oldPwd = oldPwd;
}
public String getSysCode() {
return sysCode;
}
......
package com.pica.cloud.account.account.server.service;
public interface ModifyMobileService {
void modify(Integer acctId,String mobile);
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.req.BaseRequest;
public interface PasswordService {
void modifyPassword(Integer acctId, String oldPwd, String pwd);
void forgetPassword(BaseRequest request);
}
......@@ -3,11 +3,13 @@ package com.pica.cloud.account.account.server.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.AccountUserInfoEntity;
import com.pica.cloud.account.account.server.entity.LogLoginEntity;
import com.pica.cloud.account.account.server.enums.EnumsType;
import com.pica.cloud.account.account.server.enums.ExceptionType;
import com.pica.cloud.account.account.server.log.PicaLogUtils;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.mapper.AccountUserInfoMapper;
import com.pica.cloud.account.account.server.req.AccountReq;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.LoginService;
......@@ -34,6 +36,10 @@ public class LoginServiceImpl implements LoginService {
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
private AccountUserInfoMapper accountUserInfoMapper;
@Autowired
private PicaLogUtils picaLogUtils;
......@@ -56,28 +62,30 @@ public class LoginServiceImpl implements LoginService {
String password = request.getPassword();
if (password.equals(EncryptCreateUtil.dencrypt(oldPwd))) {
//登陆成功,返回新的token
Integer id = accountInfoEntity.getId();
//通过账户id查询用户id
Date currentTime = new Date();
Integer acctId = accountInfoEntity.getId();
AccountUserInfoEntity accountUserInfoEntity = accountUserInfoMapper.selectByAcctId(acctId);
int productType = request.getProductType();
int sourceType = request.getSourceType();
Account account = new Account();
//account.setId(userId.longValue());
account.setAcctId(id);
account.setCreatTime(new Date());
account.setId(accountUserInfoEntity.getId().longValue());
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setMobilePhone(mobile);
account.setRegisterSource(sourceType);
String newToken = tokenUtils.generateToken(account);
JSONObject jsonObject = new JSONObject();
jsonObject.put("token", newToken);
//todo:登陆成功是否要返回用户id
jsonObject.put("userId", newToken);
jsonObject.put("userId", accountUserInfoEntity.getId().longValue());
LogLoginEntity entity = new LogLoginEntity();
entity.setAcctId(id);
entity.setCreateId(id);
entity.setCreateTime(new Date());
entity.setModifyId(id);
entity.setModifyTime(new Date());
entity.setAcctId(acctId);
entity.setCreateId(acctId);
entity.setCreateTime(currentTime);
entity.setModifyId(acctId);
entity.setModifyTime(currentTime);
entity.setDeleteFlag(1);
entity.setLoginTime(new Date());
entity.setLoginTime(currentTime);
entity.setProductType(productType);
entity.setSourceType(request.getSourceType());
entity.setLoginType(EnumsType.LOGIN_REGISTER.getCode());
......@@ -105,7 +113,9 @@ public class LoginServiceImpl implements LoginService {
if (accountInfoEntity == null) {
return registerService.register(baseRequest);
} else {
Integer id = accountInfoEntity.getId();
Date currentTime = new Date();
Integer acctId = accountInfoEntity.getId();
AccountUserInfoEntity accountUserInfoEntity = accountUserInfoMapper.selectByAcctId(acctId);
//验证码登陆:只要相同即可成功
AccountReq accountReq = new AccountReq();
accountReq.setAuthCode(baseRequest.getSysCode());
......@@ -113,23 +123,23 @@ public class LoginServiceImpl implements LoginService {
accountReq.setFlag("0");
checkAuthCode(accountReq);
Account account = new Account();
//account.setId(userId.longValue());
account.setAcctId(id);
account.setCreatTime(new Date());
account.setId(accountUserInfoEntity.getId().longValue());
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setMobilePhone(mobile);
account.setRegisterSource(sourceType);
String newToken = tokenUtils.generateToken(account);
JSONObject jsonObject = new JSONObject();
jsonObject.put("token", newToken);
//todo:登陆成功是否要返回用户id
jsonObject.put("userId", accountUserInfoEntity.getId().longValue());
LogLoginEntity entity = new LogLoginEntity();
entity.setAcctId(id);
entity.setCreateId(id);
entity.setCreateTime(new Date());
entity.setModifyId(id);
entity.setModifyTime(new Date());
entity.setAcctId(acctId);
entity.setCreateId(acctId);
entity.setCreateTime(currentTime);
entity.setModifyId(acctId);
entity.setModifyTime(currentTime);
entity.setDeleteFlag(1);
entity.setLoginTime(new Date());
entity.setLoginTime(currentTime);
entity.setProductType(productType);
entity.setSourceType(baseRequest.getSourceType());
entity.setLoginType(EnumsType.LOGIN_REGISTER.getCode());
......
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.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.service.ModifyMobileService;
import com.pica.cloud.foundation.utils.utils.EncryptCreateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class ModifyMobileServiceImpl implements ModifyMobileService {
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Override
public void modify(Integer acctId, String mobile) {
AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setId(acctId);
accountInfoEntity.setModifiedId(acctId);
accountInfoEntity.setModifiedTime(new Date());
accountInfoEntity.setMobilePhone(EncryptCreateUtil.encrypt(mobile));
accountInfoDetailMapper.updateMobileByPrimaryKey(accountInfoEntity);
}
}
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.LogPWDModifyEntity;
import com.pica.cloud.account.account.server.enums.EnumsType;
import com.pica.cloud.account.account.server.enums.ExceptionType;
import com.pica.cloud.account.account.server.log.PicaLogUtils;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.service.PasswordService;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.utils.utils.EncryptCreateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class PasswordServiceImpl implements PasswordService {
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
private PicaLogUtils picaLogUtils;
@Override
public void modifyPassword(Integer acctId, String oldPwd, String pwd) {
AccountInfoEntity entity = accountInfoDetailMapper.selectByPrimaryKey(acctId);
if (entity.getPassword().equals(EncryptCreateUtil.encrypt(oldPwd))) {
AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setId(acctId);
accountInfoEntity.setModifiedId(acctId);
accountInfoEntity.setModifiedTime(new Date());
accountInfoEntity.setPassword(EncryptCreateUtil.encrypt(pwd));
accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity);
//密码修改日志
Date currentTime = new Date();
LogPWDModifyEntity logPWDModifyEntity = new LogPWDModifyEntity();
logPWDModifyEntity.setCreatedId(acctId);
logPWDModifyEntity.setCreatedTime(currentTime);
logPWDModifyEntity.setDeleteFlag(1);
logPWDModifyEntity.setMobilePhone(entity.getMobilePhone());
logPWDModifyEntity.setModifiedId(acctId);
logPWDModifyEntity.setModifiedTime(currentTime);
logPWDModifyEntity.setOldPwd(EncryptCreateUtil.encrypt(oldPwd));
logPWDModifyEntity.setNewPwd(EncryptCreateUtil.encrypt(pwd));
logPWDModifyEntity.setLogType(EnumsType.LOG_TYPE_PASSWORD.getCode());
picaLogUtils.info(logPWDModifyEntity);
} else {
throw new PicaException(ExceptionType.PICA_PASSWORD_ERROR.getCode(), ExceptionType.PICA_PASSWORD_ERROR.getMessage());
}
}
@Override
public void forgetPassword(BaseRequest request) {
Integer accId = request.getAccId();
AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setId(accId);
accountInfoEntity.setModifiedId(accId);
accountInfoEntity.setModifiedTime(new Date());
accountInfoEntity.setPassword(EncryptCreateUtil.encrypt(request.getPassword()));
accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity);
//密码修改日志
Date currentTime = new Date();
LogPWDModifyEntity logPWDModifyEntity = new LogPWDModifyEntity();
logPWDModifyEntity.setCreatedId(accId);
logPWDModifyEntity.setCreatedTime(currentTime);
logPWDModifyEntity.setDeleteFlag(1);
logPWDModifyEntity.setMobilePhone(request.getMobile());
logPWDModifyEntity.setModifiedId(accId);
logPWDModifyEntity.setModifiedTime(currentTime);
logPWDModifyEntity.setOldPwd("");
logPWDModifyEntity.setNewPwd(EncryptCreateUtil.encrypt(request.getPassword()));
logPWDModifyEntity.setLogType(EnumsType.LOG_TYPE_PASSWORD.getCode());
picaLogUtils.info(logPWDModifyEntity);
}
}
......@@ -17,6 +17,7 @@ import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.utils.EncryptCreateUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -50,16 +51,21 @@ public class RegisterServiceImpl implements RegisterService {
//校验用户是否已经注册
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobile);
if (accountInfoEntity == null) {
Date currentTime = new Date();
int productType = baseRequest.getProductType();
int sourceType = baseRequest.getSourceType();
AccountInfoEntity accountInfo = new AccountInfoEntity();
accountInfo.setMobilePhone(EncryptCreateUtil.encrypt(baseRequest.getMobile()));
accountInfo.setPassword(EncryptCreateUtil.encrypt(baseRequest.getPassword()));
accountInfo.setCreatedTime(new Date());
if (!StringUtils.isNotEmpty(baseRequest.getPassword())) {
accountInfo.setPassword(EncryptCreateUtil.encrypt(baseRequest.getPassword()));
} else {
accountInfo.setPassword("");
}
accountInfo.setCreatedTime(currentTime);
accountInfo.setCreatedId(0);
accountInfo.setModifiedId(0);
accountInfo.setModifiedTime(new Date());
accountInfo.setRegTime(new Date());
accountInfo.setModifiedTime(currentTime);
accountInfo.setRegTime(currentTime);
accountInfo.setDeleteFlag(1);
accountInfo.setSex(0);
accountInfo.setRegisterProduct(productType);
......@@ -72,14 +78,14 @@ public class RegisterServiceImpl implements RegisterService {
accountUserInfoEntity.setDeleteFlag(1);
accountUserInfoEntity.setCreateId(acctId);
accountUserInfoEntity.setModifyId(acctId);
accountUserInfoEntity.setCreateTime(new Date());
accountUserInfoEntity.setModifyTime(new Date());
accountUserInfoEntity.setCreateTime(currentTime);
accountUserInfoEntity.setModifyTime(currentTime);
accountUserInfoMapper.insertSelective(accountUserInfoEntity);
Integer userId = accountUserInfoEntity.getId();
Account account = new Account();
account.setId(userId.longValue());
account.setAcctId(acctId);
account.setCreatTime(new Date());
account.setCreatTime(currentTime);
account.setMobilePhone(mobile);
account.setRegisterSource(sourceType);
String newToken = this.generateToken(account);
......@@ -89,11 +95,11 @@ public class RegisterServiceImpl implements RegisterService {
LogLoginEntity entity = new LogLoginEntity();
entity.setAcctId(acctId);
entity.setCreateId(acctId);
entity.setCreateTime(new Date());
entity.setCreateTime(currentTime);
entity.setModifyId(acctId);
entity.setModifyTime(new Date());
entity.setModifyTime(currentTime);
entity.setDeleteFlag(1);
entity.setLoginTime(new Date());
entity.setLoginTime(currentTime);
entity.setProductType(productType);
entity.setSourceType(baseRequest.getSourceType());
entity.setLoginType(EnumsType.LOGIN_REGISTER.getCode());
......
package com.pica.cloud.account.account.server.util;
public class DateEntityUtils {
// TODO: 2019/8/29 封装通用性data
// public static <T> T processTime(T t) {
//
//
// }
}
......@@ -33,7 +33,6 @@ public class TokenUtils {
public boolean checkTokenStatus(String token) {
String str = cacheClient.get("token-" + token);
return StringUtils.isBlank(str);
}
......
......@@ -43,6 +43,18 @@
update account_info set created_id=#{acctId}, modified_id=#{acctId} where id=#{acctId}
</update>
<!--更新用户的手机号-->
<update id="updateMobileByPrimaryKey"
parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info set modified_id=#{id}, modified_time=#{modifiedTime},mobile_phone=#{mobilePhone} where id=#{id}
</update>
<!--修改用户的密码-->
<update id="updatePasswordByPrimaryKey"
parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info set modified_id=#{id}, modified_time=now(),password=#{password} where id=#{id}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from account_info
where id = #{id,jdbcType=INTEGER}
......
......@@ -44,6 +44,16 @@
from account_user_info
where id = #{id,jdbcType=INTEGER}
</select>
<!--通过账户id查询信息-->
<select id="selectByAcctId" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from account_user_info
where acct_id = #{acctId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from account_user_info
where id = #{id,jdbcType=INTEGER}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册