Browse Source

居民端跳转数据端小程序 bug修改

feature/syp_points
songyunpeng 5 years ago
parent
commit
01ba0b80c0
  1. 5
      esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/controller/AuthController.java
  2. 3
      esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/AuthService.java
  3. 14
      esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/AuthServiceImpl.java
  4. 19
      esua-epdc/epdc-commons/epdc-common-clienttoken/src/main/java/com/elink/esua/epdc/common/token/dto/WorkUserAuthorizationScripDTO.java

5
esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/controller/AuthController.java

@ -139,14 +139,15 @@ public class AuthController {
public Result<WorkUserAuthorizationDTO> workScripLogin(@RequestBody WorkUserScripLoginDTO workUserLoginDto) {
//效验数据
ValidatorUtils.validateEntity(workUserLoginDto);
Result<WorkUserAuthorizationDTO> result = authService.workScripLogin(workUserLoginDto.getScrip());
Result<WorkUserAuthorizationScripDTO> result = authService.workScripLogin(workUserLoginDto.getScrip());
if (result.success()) {
workUserLoginDto.setUsername(result.getData().getUsername());
// 解绑上一次登录账户并绑定当前账户
SysUserOpenIdFormDTO sysUserOpenIdFormDto = ConvertUtils.sourceToTarget(workUserLoginDto, SysUserOpenIdFormDTO.class);
authService.modifyOpenId(sysUserOpenIdFormDto);
}
return result;
return new Result<WorkUserAuthorizationDTO>().ok(result.getData().getWorkUserAuthorizationDTO());
}
@PostMapping(value = "logout")

3
esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/AuthService.java

@ -10,6 +10,7 @@ package com.elink.esua.epdc.service;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.common.token.dto.WorkUserAuthorizationDTO;
import com.elink.esua.epdc.common.token.dto.WorkUserAuthorizationScripDTO;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.AuthorizationDTO;
import com.elink.esua.epdc.dto.DataScopeDeptList;
@ -82,5 +83,5 @@ public interface AuthService {
* @Param [scrip]
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.common.token.dto.WorkUserAuthorizationDTO>
**/
Result<WorkUserAuthorizationDTO> workScripLogin(String scrip);
Result<WorkUserAuthorizationScripDTO> workScripLogin(String scrip);
}

14
esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/AuthServiceImpl.java

@ -12,6 +12,7 @@ import com.elink.esua.epdc.async.UserDeptTask;
import com.elink.esua.epdc.common.token.dto.DeptDataScopeDTO;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.common.token.dto.WorkUserAuthorizationDTO;
import com.elink.esua.epdc.common.token.dto.WorkUserAuthorizationScripDTO;
import com.elink.esua.epdc.common.token.util.CpUserDetailRedis;
import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
@ -299,7 +300,7 @@ public class AuthServiceImpl implements AuthService {
}
@Override
public Result<WorkUserAuthorizationDTO> workScripLogin(String scrip) {
public Result<WorkUserAuthorizationScripDTO> workScripLogin(String scrip) {
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
//获取用户信息
@ -324,7 +325,7 @@ public class AuthServiceImpl implements AuthService {
log.setCreatorName(scrip);
logProducer.saveLog(log);
authorization.setRegisterState(NumConstant.ZERO_STR);
return new Result<WorkUserAuthorizationDTO>().error("未根据凭证获取到用户");
return new Result<WorkUserAuthorizationScripDTO>().error("未根据凭证获取到用户");
}
//账号停用
@ -333,7 +334,7 @@ public class AuthServiceImpl implements AuthService {
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
logProducer.saveLog(log);
return new Result<WorkUserAuthorizationDTO>().error("账号已停用");
return new Result<WorkUserAuthorizationScripDTO>().error("账号已停用");
}
//保存到Redis
@ -360,6 +361,9 @@ public class AuthServiceImpl implements AuthService {
authorization.setRegisterState(NumConstant.ONE_STR);
userDeptTask.packageUserDeptOptions(user.getId());
return new Result<WorkUserAuthorizationDTO>().ok(authorization); }
WorkUserAuthorizationScripDTO workUserAuthorizationScripDTO = new WorkUserAuthorizationScripDTO();
workUserAuthorizationScripDTO.setWorkUserAuthorizationDTO(authorization);
workUserAuthorizationScripDTO.setUsername(user.getUsername());
return new Result<WorkUserAuthorizationScripDTO>().ok(workUserAuthorizationScripDTO);
}
}

19
esua-epdc/epdc-commons/epdc-common-clienttoken/src/main/java/com/elink/esua/epdc/common/token/dto/WorkUserAuthorizationScripDTO.java

@ -0,0 +1,19 @@
package com.elink.esua.epdc.common.token.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author songyunpeng
* @Description 数据端临时凭证登录返回
* @create 2020-06-23
*/
@Data
public class WorkUserAuthorizationScripDTO implements Serializable {
private static final long serialVersionUID = 1905641243346550379L;
private String username;
private WorkUserAuthorizationDTO workUserAuthorizationDTO;
}
Loading…
Cancel
Save