From 56ce29ff304f4c728ce6abe388204a8c518e0607 Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Tue, 18 Aug 2020 10:56:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lz/modules/app/entity/StaffEntity.java | 10 ++-- .../sys/controller/SysLoginController.java | 2 + .../lz/modules/sys/entity/SysUserEntity.java | 1 + .../sys/entity/SysUserTokenEntity.java | 3 +- .../modules/sys/entity/app/ResultRecord.java | 56 ++++++++++++++++++- .../lz/modules/sys/oauth2/OAuth2Realm.java | 6 +- .../mapper/app/ResultRecordMapper.xml | 24 ++++++-- .../resources/mapper/generator/StaffDao.xml | 33 ++++++----- src/test/java/com/lz/mysql/MysqlMain.java | 13 +---- 9 files changed, 109 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/lz/modules/app/entity/StaffEntity.java b/src/main/java/com/lz/modules/app/entity/StaffEntity.java index 1bbac279..feeac7ff 100644 --- a/src/main/java/com/lz/modules/app/entity/StaffEntity.java +++ b/src/main/java/com/lz/modules/app/entity/StaffEntity.java @@ -113,9 +113,11 @@ public class StaffEntity implements Serializable { */ private String jobNumber; - //审批的父亲节点 id - private Long parentId; - //0不是主管,1 是主管 - private Integer isMaster; + + //密码 + private String password; + //盐 + private String salt; + } diff --git a/src/main/java/com/lz/modules/sys/controller/SysLoginController.java b/src/main/java/com/lz/modules/sys/controller/SysLoginController.java index 69341af4..ff927c14 100644 --- a/src/main/java/com/lz/modules/sys/controller/SysLoginController.java +++ b/src/main/java/com/lz/modules/sys/controller/SysLoginController.java @@ -188,8 +188,10 @@ public class SysLoginController extends AbstractController { } codeRecordEntity.setIsCheck(1); codeRecordService.updateById(codeRecordEntity); + //生成token,并保存到数据库 R r = sysUserTokenService.createToken(user.getUserId()); + return r; } diff --git a/src/main/java/com/lz/modules/sys/entity/SysUserEntity.java b/src/main/java/com/lz/modules/sys/entity/SysUserEntity.java index 1413f5f7..1c7b8952 100644 --- a/src/main/java/com/lz/modules/sys/entity/SysUserEntity.java +++ b/src/main/java/com/lz/modules/sys/entity/SysUserEntity.java @@ -102,4 +102,5 @@ public class SysUserEntity implements Serializable { */ private Date createTime; + private int type ;// 0 表示系统用户,1 表示普通员工 } diff --git a/src/main/java/com/lz/modules/sys/entity/SysUserTokenEntity.java b/src/main/java/com/lz/modules/sys/entity/SysUserTokenEntity.java index 6c42a31d..85312a2e 100644 --- a/src/main/java/com/lz/modules/sys/entity/SysUserTokenEntity.java +++ b/src/main/java/com/lz/modules/sys/entity/SysUserTokenEntity.java @@ -26,7 +26,6 @@ import java.util.Date; @TableName("sys_user_token") public class SysUserTokenEntity implements Serializable { private static final long serialVersionUID = 1L; - //用户ID @TableId(type = IdType.INPUT) private Long userId; @@ -36,5 +35,7 @@ public class SysUserTokenEntity implements Serializable { private Date expireTime; //更新时间 private Date updateTime; + // 0 表示系统用户,1 表示普通员工 + private int type ; } diff --git a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java index 811a24f9..8e9f1aea 100644 --- a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java +++ b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java @@ -11,7 +11,7 @@ import java.util.Date; * 菜单权限表 *

*业绩记录表 * @author quyixiao -* @since 2020-08-12 +* @since 2020-08-18 */ @Data @@ -38,6 +38,12 @@ public class ResultRecord implements java.io.Serializable { private String remark; //员工id private Long staffId; + //类型 ,1 表示提交目标,2 表示提交结果 + private Integer type; + //在新建时的角色 id + private Long initRoleId; + //当前审批流转所在员工 id + private Long currentFlowStaffId; /** * * @return @@ -188,6 +194,51 @@ public class ResultRecord implements java.io.Serializable { this.staffId = staffId; } + /** + * 类型 ,1 表示提交目标,2 表示提交结果 + * @return + */ + public Integer getType() { + return type; + } + /** + * 类型 ,1 表示提交目标,2 表示提交结果 + * @param type + */ + public void setType(Integer type) { + this.type = type; + } + + /** + * 在新建时的角色 id + * @return + */ + public Long getInitRoleId() { + return initRoleId; + } + /** + * 在新建时的角色 id + * @param initRoleId + */ + public void setInitRoleId(Long initRoleId) { + this.initRoleId = initRoleId; + } + + /** + * 当前审批流转所在员工 id + * @return + */ + public Long getCurrentFlowStaffId() { + return currentFlowStaffId; + } + /** + * 当前审批流转所在员工 id + * @param currentFlowStaffId + */ + public void setCurrentFlowStaffId(Long currentFlowStaffId) { + this.currentFlowStaffId = currentFlowStaffId; + } + @Override public String toString() { return "ResultRecord{" + @@ -201,6 +252,9 @@ public class ResultRecord implements java.io.Serializable { ",allScore=" + allScore + ",remark=" + remark + ",staffId=" + staffId + + ",type=" + type + + ",initRoleId=" + initRoleId + + ",currentFlowStaffId=" + currentFlowStaffId + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/oauth2/OAuth2Realm.java b/src/main/java/com/lz/modules/sys/oauth2/OAuth2Realm.java index 02a86456..db5fd15f 100644 --- a/src/main/java/com/lz/modules/sys/oauth2/OAuth2Realm.java +++ b/src/main/java/com/lz/modules/sys/oauth2/OAuth2Realm.java @@ -54,26 +54,26 @@ public class OAuth2Realm extends AuthorizingRealm { /** * 认证(登录时调用) + * + * */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { String accessToken = (String) token.getPrincipal(); - //根据accessToken,查询用户信息 SysUserTokenEntity tokenEntity = shiroService.queryByToken(accessToken); //token失效 if(tokenEntity == null || tokenEntity.getExpireTime().getTime() < System.currentTimeMillis()){ throw new IncorrectCredentialsException("token失效,请重新登录"); } - //查询用户信息 SysUserEntity user = shiroService.queryUser(tokenEntity.getUserId()); //账号锁定 if(user.getStatus() == 0){ throw new LockedAccountException("账号已被锁定,请联系管理员"); } - SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, accessToken, getName()); return info; } + } diff --git a/src/main/resources/mapper/app/ResultRecordMapper.xml b/src/main/resources/mapper/app/ResultRecordMapper.xml index 55088f8e..8569954d 100644 --- a/src/main/resources/mapper/app/ResultRecordMapper.xml +++ b/src/main/resources/mapper/app/ResultRecordMapper.xml @@ -14,17 +14,17 @@ + + + - id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, month_time AS monthTime, status AS status, last_score AS lastScore, all_score AS allScore, remark AS remark, staff_id AS staffId + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, month_time AS monthTime, status AS status, last_score AS lastScore, all_score AS allScore, remark AS remark, staff_id AS staffId, type AS type, init_role_id AS initRoleId, current_flow_staff_id AS currentFlowStaffId - - - @@ -38,6 +38,9 @@ all_score, remark, staff_id, + type, + init_role_id, + current_flow_staff_id, is_delete, gmt_create, gmt_modified @@ -48,6 +51,9 @@ #{ allScore}, #{ remark}, #{ staffId}, + #{ type}, + #{ initRoleId}, + #{ currentFlowStaffId}, 0, now(), now() @@ -66,7 +72,10 @@ last_score = #{lastScore}, all_score = #{allScore}, remark = #{remark}, - staff_id = #{staffId} + staff_id = #{staffId}, + type = #{type}, + init_role_id = #{initRoleId}, + current_flow_staff_id = #{currentFlowStaffId} ,gmt_modified = now() where id = #{id} @@ -84,7 +93,10 @@ last_score = #{lastScore}, all_score = #{allScore}, remark = #{remark}, - staff_id = #{staffId} + staff_id = #{staffId}, + type = #{type}, + init_role_id = #{initRoleId}, + current_flow_staff_id = #{currentFlowStaffId} ,gmt_modified = now() where id = #{id} diff --git a/src/main/resources/mapper/generator/StaffDao.xml b/src/main/resources/mapper/generator/StaffDao.xml index e62762be..0b1e5342 100644 --- a/src/main/resources/mapper/generator/StaffDao.xml +++ b/src/main/resources/mapper/generator/StaffDao.xml @@ -25,11 +25,10 @@ - - - - - + + + + @@ -65,8 +64,10 @@ open_id, employee_id, union_id, - parent_id, - is_master, + avatar, + job_number, + password, + salt, is_delete, create_time, update_time @@ -87,8 +88,10 @@ #{ openId}, #{ employeeId}, #{ unionId}, - #{ parentId}, - #{ isMaster}, + #{ avatar}, + #{ jobNumber}, + #{ password}, + #{ salt}, 0, now(), now() @@ -118,8 +121,10 @@ open_id = #{openId}, employee_id = #{employeeId}, union_id = #{unionId}, - parent_id = #{parentId}, - is_master = #{isMaster} + avatar = #{avatar}, + job_number = #{jobNumber}, + password = #{password}, + salt = #{salt} ,update_time = now() where id = #{id} @@ -148,8 +153,10 @@ open_id = #{openId}, employee_id = #{employeeId}, union_id = #{unionId}, - parent_id = #{parentId}, - is_master = #{isMaster} + avatar = #{avatar}, + job_number = #{jobNumber}, + password = #{password}, + salt = #{salt} ,update_time = now() where id = #{id} diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java index b59cc42d..701eb043 100644 --- a/src/test/java/com/lz/mysql/MysqlMain.java +++ b/src/test/java/com/lz/mysql/MysqlMain.java @@ -60,21 +60,12 @@ public class MysqlMain { file.mkdirs(); } List list = new ArrayList(); - list.add(new TablesBean("lz_flow")); - list.add(new TablesBean("lz_flow_department")); - list.add(new TablesBean("lz_flow_record")); - list.add(new TablesBean("lz_flow_relation")); - list.add(new TablesBean("lz_record_auth")); - list.add(new TablesBean("lz_record_role")); - list.add(new TablesBean("lz_record_role_auth")); - list.add(new TablesBean("lz_staff_role")); - list.add(new TablesBean("lz_staff_role_department")); - list.add(new TablesBean("third_app_config")); + list.add(new TablesBean("lz_staff")); + list.add(new TablesBean("lz_result_record")); List list2 = new ArrayList(); Map map = MysqlUtil2ShowCreateTable.getComments(); - for (int i = 0; i < list.size(); i++) { TablesBean obj = list.get(i); String tableName = list.get(i).getTableName();