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

20191114 注册用户角色管理

上级 58db2c5a
流水线 #17109 已失败 于阶段
in 0 second
......@@ -79,6 +79,12 @@
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>-->
<dependency>
<groupId>com.corundumstudio.socketio</groupId>
<artifactId>netty-socketio</artifactId>
<version>1.7.17</version>
</dependency>
<dependency>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-utils</artifactId>
......
......@@ -122,8 +122,8 @@ public class Test {
System.out.println("--------------------获取验证码接口-------------");
BaseRequest authCode = new BaseRequest();
authCode.setFlag(3);
authCode.setMobile("13024112092");
authCode.setFlag(1);
authCode.setMobile("13024112100");
String authCodeStr = JSONObject.toJSONString(authCode);
System.out.println(authCodeStr);
String contentResult2 = AESUtil.aesEncrypt(authCodeStr, "YCPQPx4qpQjEjDea");
......@@ -137,9 +137,9 @@ public class Test {
//获取注册参数
BaseRequest register = null;
register = new BaseRequest();
register.setMobile("13024112092");
register.setMobile("13024112100");
register.setPassword("D0DCBF0D12A6B1E7FBFA2CE5848F3EFF");
register.setAuthCode("843895");
register.setAuthCode("654003");
String registerString3 = JSONObject.toJSONString(register);
String contentResult3 = AESUtil.aesEncrypt(registerString3, "YCPQPx4qpQjEjDea");
String keyResult3 = RSAUtil.encrypt("YCPQPx4qpQjEjDea",publicKey);
......
......@@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration;
/**
* Created on 2019/11/14 13:44
* author:crs
* Description:XXX
* Description:JobExecutorConfiguration
*/
@Configuration
public class JobExecutorConfiguration {
......
......@@ -51,7 +51,6 @@ public class RegisterController extends AccountBaseController {
String flag = AccountTypeEnum.SYSCODE_TYPE_REGISTER.getCode() + "";
accountUtils.checkMobilePhoneAndAuthCode(mobile, flag, authCode);
accountUtils.checkPassword(request.getPassword());
LoginResult result = null;
request.setFlag(AccountTypeEnum.SYSCODE_TYPE_REGISTER.getCode());
request.setProductType(super.getProductType());
......
package com.pica.cloud.account.account.server.entity;
import java.util.Date;
public class PUserRole {
private Integer id;
private Integer systemId;
private Integer userRoleId;
private Integer userId;
private Integer userType;
private String param1;
private String param2;
private String param3;
private String param4;
private String param5;
private Integer status;
private Integer deleteFlag;
private Integer creatId;
private Date creatTime;
private Integer modifyId;
private Date modifyTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSystemId() {
return systemId;
}
public void setSystemId(Integer systemId) {
this.systemId = systemId;
}
public Integer getUserRoleId() {
return userRoleId;
}
public void setUserRoleId(Integer userRoleId) {
this.userRoleId = userRoleId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
public String getParam1() {
return param1;
}
public void setParam1(String param1) {
this.param1 = param1 == null ? null : param1.trim();
}
public String getParam2() {
return param2;
}
public void setParam2(String param2) {
this.param2 = param2 == null ? null : param2.trim();
}
public String getParam3() {
return param3;
}
public void setParam3(String param3) {
this.param3 = param3 == null ? null : param3.trim();
}
public String getParam4() {
return param4;
}
public void setParam4(String param4) {
this.param4 = param4 == null ? null : param4.trim();
}
public String getParam5() {
return param5;
}
public void setParam5(String param5) {
this.param5 = param5 == null ? null : param5.trim();
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatId() {
return creatId;
}
public void setCreatId(Integer creatId) {
this.creatId = creatId;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Integer getModifyId() {
return modifyId;
}
public void setModifyId(Integer modifyId) {
this.modifyId = modifyId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
}
\ No newline at end of file
......@@ -39,7 +39,7 @@ public class DoctorRepeatDataJob {
if (exist==null){
cacheClient.set(KEY,"1");
cacheClient.expire(KEY, 60 * 10);
logger.info("开始执行刷新doctor表中重复的记录");
logger.info("DoctorRepeatDataJob:开始执行刷新doctor表中重复的记录");
int row = doctorMapper.processDoctorRepeatData();
logger.info("此次数据刷新影响的行数:{}", row);
try {
......
package com.pica.cloud.account.account.server.mapper;
import com.pica.cloud.account.account.server.entity.PUserRole;
public interface PUserRoleMapper {
int deleteByPrimaryKey(Integer id);
int insert(PUserRole record);
int insertSelective(PUserRole record);
PUserRole selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PUserRole record);
int updateByPrimaryKey(PUserRole record);
}
\ No newline at end of file
......@@ -22,8 +22,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;
@Service
......@@ -33,6 +35,9 @@ public class RegisterServiceImpl implements RegisterService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private PUserRoleMapper pUserRoleMapper;
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
......@@ -72,6 +77,7 @@ public class RegisterServiceImpl implements RegisterService {
* @param baseRequest 参数模型
* @return
*/
@Transactional
@Override
public LoginResult register(BaseRequest baseRequest) {
String mobile = baseRequest.getMobile();
......@@ -139,7 +145,6 @@ public class RegisterServiceImpl implements RegisterService {
account.setMobilePhone(mobile);
account.setRegisterSource(sourceType);
String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId);
......@@ -157,6 +162,7 @@ public class RegisterServiceImpl implements RegisterService {
AccountTypeEnum.LOG_TYPE_LOGIN.getCode());
picaLogUtils.info(entity);
processAgreement(userId);
processRoleMap(userId);
redisClient.del(REPEAT_REGISTER_PREFIX + mobile);
return result;
} catch (Exception e) {
......@@ -174,6 +180,35 @@ public class RegisterServiceImpl implements RegisterService {
}
}
/**
* 异步处理用户角色
* @param userId
*/
private void processRoleMap(Long userId) {
ExecutorServiceUtils.getExecutor().submit(new Runnable() {
@Override
public void run() {
Date date = new Date();
PUserRole pUserRole = new PUserRole();
pUserRole.setSystemId(5);
pUserRole.setUserRoleId(2);
pUserRole.setUserId(userId.intValue());
pUserRole.setUserType(1);
pUserRole.setStatus(2);
pUserRole.setDeleteFlag(1);
pUserRole.setCreatId(userId.intValue());
pUserRole.setCreatTime(date);
pUserRole.setModifyId(userId.intValue());
pUserRole.setModifyTime(date);
pUserRoleMapper.insertSelective(pUserRole);
pUserRole.setSystemId(1);
pUserRoleMapper.insertSelective(pUserRole);
pUserRole.setSystemId(3);
pUserRoleMapper.insertSelective(pUserRole);
}
});
}
/**
* 长海项目医生自动注册,并完善信息
*
......
spring.profiles.active=dev
\ No newline at end of file
spring.profiles.active=uat
\ No newline at end of file
<?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.PUserRoleMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.PUserRole" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="system_id" property="systemId" jdbcType="INTEGER" />
<result column="user_role_id" property="userRoleId" jdbcType="INTEGER" />
<result column="user_id" property="userId" jdbcType="INTEGER" />
<result column="user_type" property="userType" jdbcType="INTEGER" />
<result column="param_1" property="param1" jdbcType="VARCHAR" />
<result column="param_2" property="param2" jdbcType="VARCHAR" />
<result column="param_3" property="param3" jdbcType="VARCHAR" />
<result column="param_4" property="param4" jdbcType="VARCHAR" />
<result column="param_5" property="param5" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER" />
<result column="creat_id" property="creatId" jdbcType="INTEGER" />
<result column="creat_time" property="creatTime" jdbcType="TIMESTAMP" />
<result column="modify_id" property="modifyId" jdbcType="INTEGER" />
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, system_id, user_role_id, user_id, user_type, param_1, param_2, param_3, param_4,
param_5, status, delete_flag, creat_id, creat_time, modify_id, modify_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from p_user_role_mapping
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from p_user_role_mapping
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.PUserRole" >
insert into p_user_role_mapping (id, system_id, user_role_id,
user_id, user_type, param_1,
param_2, param_3, param_4,
param_5, status, delete_flag,
creat_id, creat_time, modify_id,
modify_time)
values (#{id,jdbcType=INTEGER}, #{systemId,jdbcType=INTEGER}, #{userRoleId,jdbcType=INTEGER},
#{userId,jdbcType=INTEGER}, #{userType,jdbcType=INTEGER}, #{param1,jdbcType=VARCHAR},
#{param2,jdbcType=VARCHAR}, #{param3,jdbcType=VARCHAR}, #{param4,jdbcType=VARCHAR},
#{param5,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{deleteFlag,jdbcType=INTEGER},
#{creatId,jdbcType=INTEGER}, #{creatTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=INTEGER},
#{modifyTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.PUserRole" >
insert into p_user_role_mapping
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="systemId != null" >
system_id,
</if>
<if test="userRoleId != null" >
user_role_id,
</if>
<if test="userId != null" >
user_id,
</if>
<if test="userType != null" >
user_type,
</if>
<if test="param1 != null" >
param_1,
</if>
<if test="param2 != null" >
param_2,
</if>
<if test="param3 != null" >
param_3,
</if>
<if test="param4 != null" >
param_4,
</if>
<if test="param5 != null" >
param_5,
</if>
<if test="status != null" >
status,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
<if test="creatId != null" >
creat_id,
</if>
<if test="creatTime != null" >
creat_time,
</if>
<if test="modifyId != null" >
modify_id,
</if>
<if test="modifyTime != null" >
modify_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="systemId != null" >
#{systemId,jdbcType=INTEGER},
</if>
<if test="userRoleId != null" >
#{userRoleId,jdbcType=INTEGER},
</if>
<if test="userId != null" >
#{userId,jdbcType=INTEGER},
</if>
<if test="userType != null" >
#{userType,jdbcType=INTEGER},
</if>
<if test="param1 != null" >
#{param1,jdbcType=VARCHAR},
</if>
<if test="param2 != null" >
#{param2,jdbcType=VARCHAR},
</if>
<if test="param3 != null" >
#{param3,jdbcType=VARCHAR},
</if>
<if test="param4 != null" >
#{param4,jdbcType=VARCHAR},
</if>
<if test="param5 != null" >
#{param5,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="creatId != null" >
#{creatId,jdbcType=INTEGER},
</if>
<if test="creatTime != null" >
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null" >
#{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null" >
#{modifyTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.PUserRole" >
update p_user_role_mapping
<set >
<if test="systemId != null" >
system_id = #{systemId,jdbcType=INTEGER},
</if>
<if test="userRoleId != null" >
user_role_id = #{userRoleId,jdbcType=INTEGER},
</if>
<if test="userId != null" >
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="userType != null" >
user_type = #{userType,jdbcType=INTEGER},
</if>
<if test="param1 != null" >
param_1 = #{param1,jdbcType=VARCHAR},
</if>
<if test="param2 != null" >
param_2 = #{param2,jdbcType=VARCHAR},
</if>
<if test="param3 != null" >
param_3 = #{param3,jdbcType=VARCHAR},
</if>
<if test="param4 != null" >
param_4 = #{param4,jdbcType=VARCHAR},
</if>
<if test="param5 != null" >
param_5 = #{param5,jdbcType=VARCHAR},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="creatId != null" >
creat_id = #{creatId,jdbcType=INTEGER},
</if>
<if test="creatTime != null" >
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null" >
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null" >
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.PUserRole" >
update p_user_role_mapping
set system_id = #{systemId,jdbcType=INTEGER},
user_role_id = #{userRoleId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
user_type = #{userType,jdbcType=INTEGER},
param_1 = #{param1,jdbcType=VARCHAR},
param_2 = #{param2,jdbcType=VARCHAR},
param_3 = #{param3,jdbcType=VARCHAR},
param_4 = #{param4,jdbcType=VARCHAR},
param_5 = #{param5,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
creat_id = #{creatId,jdbcType=INTEGER},
creat_time = #{creatTime,jdbcType=TIMESTAMP},
modify_id = #{modifyId,jdbcType=INTEGER},
modify_time = #{modifyTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册