Browse Source

Merge remote-tracking branch 'remotes/origin/dev_ljj' into dev_temp

master
jianjun 4 years ago
parent
commit
5522dfbaf4
  1. 7
      epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java
  2. 7
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

7
epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java

@ -6,7 +6,6 @@ import com.epmet.dto.form.*;
import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.ThirdLoginService; import com.epmet.service.ThirdLoginService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -20,7 +19,6 @@ import java.util.List;
* @Description 第三方-居民端政府端登陆服务 * @Description 第三方-居民端政府端登陆服务
* @author sun * @author sun
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("thirdlogin") @RequestMapping("thirdlogin")
public class ThirdLoginController { public class ThirdLoginController {
@ -36,11 +34,8 @@ public class ThirdLoginController {
**/ **/
@PostMapping("resilogin") @PostMapping("resilogin")
public Result<UserTokenResultDTO> resiLogin(@RequestBody LoginFormDTO formDTO) { public Result<UserTokenResultDTO> resiLogin(@RequestBody LoginFormDTO formDTO) {
long start = System.currentTimeMillis();
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
UserTokenResultDTO resultDTO = thirdLoginService.resiLogin(formDTO); return new Result<UserTokenResultDTO>().ok(thirdLoginService.resiLogin(formDTO));
log.error("resilogin total cost:{}",System.currentTimeMillis()-start);
return new Result<UserTokenResultDTO>().ok(resultDTO);
} }
/** /**

7
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -65,15 +65,12 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
**/ **/
@Override @Override
public UserTokenResultDTO resiLogin(LoginFormDTO formDTO) { public UserTokenResultDTO resiLogin(LoginFormDTO formDTO) {
long start = System.currentTimeMillis();
//1.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息 //1.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息
WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO(); WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO();
resiLoginFormDTO.setAppId(formDTO.getAppId()); resiLoginFormDTO.setAppId(formDTO.getAppId());
resiLoginFormDTO.setWxCode(formDTO.getWxCode()); resiLoginFormDTO.setWxCode(formDTO.getWxCode());
UserWechatDTO userWechatDTO = this.getUserWeChat(resiLoginFormDTO); UserWechatDTO userWechatDTO = this.getUserWeChat(resiLoginFormDTO);
logger.error("resiLogin getUserWeChat cost time:{}",System.currentTimeMillis()-start);
start = System.currentTimeMillis();
//2.调用epmet-user服务,新增用户信息(先判断用户是否存在,不存在则新增存在则更新) //2.调用epmet-user服务,新增用户信息(先判断用户是否存在,不存在则新增存在则更新)
WxUserFormDTO wxUserFormDTO = new WxUserFormDTO(); WxUserFormDTO wxUserFormDTO = new WxUserFormDTO();
wxUserFormDTO.setWechatDTO(userWechatDTO); wxUserFormDTO.setWechatDTO(userWechatDTO);
@ -82,8 +79,6 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
if (!userResult.success()) { if (!userResult.success()) {
throw new RenException(userResult.getCode()); throw new RenException(userResult.getCode());
} }
logger.error("resiLogin saveWxUser cost time:{}",System.currentTimeMillis()-start);
start = System.currentTimeMillis();
UserDTO userDTO = userResult.getData(); UserDTO userDTO = userResult.getData();
//3.生成业务token //3.生成业务token
@ -96,7 +91,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
//5.接口返参 //5.接口返参
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token); userTokenResultDTO.setToken(token);
logger.error("resiLogin generateToken cost time:{}",System.currentTimeMillis()-start);
return userTokenResultDTO; return userTokenResultDTO;
} }

Loading…
Cancel
Save