master
shijie 4 years ago
parent f7350de88d
commit 00ca161acb
  1. 5
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/RolePermissionController.java
  2. 6
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java
  3. 4
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/handle/AdminAuthenticationProvider.java
  4. 3
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java
  5. 11
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserServiceImpl.java
  6. 10
      dq-financial-hrms-auth/src/main/resources/mapper/hrauth/RolePermissionMapper.xml
  7. 4
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/UserEntity.java
  8. 4
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/RolePermissionRequest.java

@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@ -89,7 +90,7 @@ public class RolePermissionController {
*/
@Transactional
@PostMapping("/saveRolePermission")
public ResponseResult saveRolePermission(@RequestBody RolePermissionRequest rolePermission) {
public ResponseResult saveRolePermission(@Valid @RequestBody RolePermissionRequest rolePermission) {
Date date = new Date();
rolePermission.setCreateTime(date);
rolePermission.setMotifyTime(date);
@ -122,7 +123,7 @@ public class RolePermissionController {
*/
@Transactional
@PostMapping("/updateRolePermission")
public ResponseResult updateRolePermission(@RequestBody RolePermissionRequest rolePermission) {
public ResponseResult updateRolePermission(@Valid @RequestBody RolePermissionRequest rolePermission) {
Date date = new Date();
rolePermission.setMotifyTime(date);
//根据角色Id修改角色内容

@ -127,10 +127,12 @@ public class UserLoginController implements UserLoginControllerApi {
if("STATE".equals(state)){
UserEntity user = userService.saveWeChatUser(code,response);
if(user != null){
long times = 86400;
/* long times = 86400;
//生成jwt
String token = JwtUtils.createJWT(user.getId()+"","token", times);
RedisUtil.setEx("dq:token:"+token,String.valueOf(user.getId()),times);
RedisUtil.setEx("dq:token:"+token,String.valueOf(user.getId()),times);*/
String token = user.getToken();
// state 当前用户的页面地址,需要拼接 http:// 这样才不会站内跳转
response.sendRedirect("http://www.huorantech.cn/dq/index.html#/Dashboard?token="+token);
//response.sendRedirect(state+"?token="+token+"&head_img="+user.getHeadImg()+"&name="+URLEncoder.encode(user.getName(),"UTF-8"));

@ -72,6 +72,10 @@ public class AdminAuthenticationProvider implements AuthenticationProvider {
userMapper.updateById(user);
userInfo.getCurrentUserInfo().setToken(token);*/
//根据id查询员工信息
Long id = userInfo.getCurrentUserInfo().getId();
userInfo.getCurrentUserInfo().setToken(data.getToken());
return new UsernamePasswordAuthenticationToken(userInfo, password, userInfo.getAuthorities());
}

@ -126,7 +126,8 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginDao, UserEntity>
}else {//微信登录
if(userEntity == null){
return ResponseResult.FAIL(CommonCode.USER_IS_NOT_EXIST.code(), CommonCode.USER_IS_NOT_EXIST.message());
throw new UsernameNotFoundException("用户不存在或已禁用!");
//return ResponseResult.FAIL(CommonCode.USER_IS_NOT_EXIST.code(), CommonCode.USER_IS_NOT_EXIST.message());
}
}
//登录成功,token生成

@ -74,10 +74,13 @@ public class UserServiceImpl extends ServiceImpl<UserLoginDao, UserEntity> imple
ResponseResult login = userLoginService.login(loginRequest);
LoginResponse data = (LoginResponse) login.getData();
// SecurityUser userInfo = (SecurityUser) userDetailsService.loadUserByUsername(dbUser.getPhoneAccount());
//
// userInfo.getCurrentUserInfo().setToken(data.getToken());
// new UsernamePasswordAuthenticationToken(userInfo, null, userInfo.getAuthorities());
log.info("token========================"+data.getToken());
dbUser.setToken(data.getToken());
/* SecurityUser userInfo = (SecurityUser) userDetailsService.loadUserByUsername(dbUser.getPhoneAccount());
userInfo.getCurrentUserInfo().setToken(data.getToken());
new UsernamePasswordAuthenticationToken(userInfo, null, userInfo.getAuthorities());*/
return dbUser;
}

@ -59,15 +59,13 @@
<update id="updateHrmsRole" parameterType="com.daqing.framework.domain.hrms.request.RolePermissionRequest">
UPDATE hrms_role
<set>
<if test="name != null and name != ''">
`name`=#{name},
</if>
<if test="description != null and description != ''">
description=#{description},
</if>
<if test="motifyTime != null">
motify_time=#{motifyTime},
</if>
</set>
WHERE id = #{roleId}
</update>

@ -95,5 +95,9 @@ public class UserEntity implements Serializable {
* 盐值
*/
//private String salt;
/**
* 头像地址
*/
//private String headPortaritUrl;
}

@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@ -48,6 +51,7 @@ public class RolePermissionRequest implements Serializable {
/**
* 权限ids
*/
@NotEmpty(message = "权限至少选中一项!")
private Long[] permissionIds;
private Long permissionId;

Loading…
Cancel
Save