feat:添加耗时日志

This commit is contained in:
dzc committed 2026-04-28 17:56:01 +08:00
1 parent 1c66276bb1
commit c1a11d8f86
1 file changed
+24 -10
@@ -67,11 +67,17 @@ public class ThirdMiniAppServiceImpl implements ThirdMiniAppService {
*/
@Override
public ThirdMinAppOAth2LoginVo adminLogin(ThirdMiniAppOAth2LoginDto dto) {
long startTime = System.currentTimeMillis();
ThirdMinAppOAth2LoginVo vo = new ThirdMinAppOAth2LoginVo();
// 微信小程序
if (ObjectUtil.equals(dto.getMiniPlatformType().getType(), MiniPlatformTypeEnum.WECHAT.getType())) {
// 获取手机号
long getPhoneStartTime = System.currentTimeMillis();
WxMaPhoneNumberInfo phoneInfo = thirdMiniAppWechatService.getPhone(dto.getPhoneCode());
long getPhoneEndTime = System.currentTimeMillis();
log.info("|{}|getPhone耗时: {} ms", TAG, (getPhoneEndTime - getPhoneStartTime));
if (ObjectUtil.isEmpty(phoneInfo)) {
vo.setErrorCode(MiniPlatformLoginErrorEnum.GET_PHONE_ERROR.getType());
return vo;
@@ -83,22 +89,28 @@ public class ThirdMiniAppServiceImpl implements ThirdMiniAppService {
return vo;
}
// 获取用户唯一编号
long getUnicodeStartTime = System.currentTimeMillis();
ThirdMiniAppGetUniqueDto getUniqueDto = new ThirdMiniAppGetUniqueDto();
getUniqueDto.setMiniPlatformType(MiniPlatformTypeEnum.WECHAT);
getUniqueDto.setCode(dto.getPhoneCode());
getUniqueDto.setUserId(userInfo.getSysUser().getUserId());
String uniqueCode = getUniqueCode(getUniqueDto);
long getUnicodeEndTime = System.currentTimeMillis();
log.info("|{}|getUniqueCode耗时: {} ms", TAG, (getUnicodeEndTime - getUnicodeStartTime));
// 同步到社交用户
AppAdminSyncDto appAdminSyncDto = new AppAdminSyncDto();
appAdminSyncDto.setUniqueCode(uniqueCode);
appAdminSyncDto.setUserTypeEnum(AppUserTypeEnum.MINI_WECHAT);
appAdminSyncDto.setAdminUserId(userInfo.getSysUser().getUserId());
appAdminSyncDto.setUsername(userInfo.getSysUser().getUsername());
appAdminSyncDto.setAvatarImage(userInfo.getSysUser().getAvatar());
AppUserInfo appUserInfo = remoteAppUserService.syncAdminAccountInfo(appAdminSyncDto).getData();
if (ObjectUtil.isEmpty(appUserInfo)) {
vo.setErrorCode(MiniPlatformLoginErrorEnum.LOGIN_ERROR.getType());
return vo;
if (ObjectUtil.isNotEmpty(uniqueCode)) {
AppAdminSyncDto appAdminSyncDto = new AppAdminSyncDto();
appAdminSyncDto.setUniqueCode(uniqueCode);
appAdminSyncDto.setUserTypeEnum(AppUserTypeEnum.MINI_WECHAT);
appAdminSyncDto.setAdminUserId(userInfo.getSysUser().getUserId());
appAdminSyncDto.setUsername(userInfo.getSysUser().getUsername());
appAdminSyncDto.setAvatarImage(userInfo.getSysUser().getAvatar());
AppUserInfo appUserInfo = remoteAppUserService.syncAdminAccountInfo(appAdminSyncDto).getData();
if (ObjectUtil.isEmpty(appUserInfo)) {
vo.setErrorCode(MiniPlatformLoginErrorEnum.LOGIN_ERROR.getType());
return vo;
}
}
// 执行登录
UserTokenDTO userTokenDTO = new UserTokenDTO();
@@ -115,6 +127,8 @@ public class ThirdMiniAppServiceImpl implements ThirdMiniAppService {
else if (ObjectUtil.equals(dto.getMiniPlatformType().getType(), MiniPlatformTypeEnum.ALI_PAY.getType())) {
}
long endTime = System.currentTimeMillis();
log.info("|{}|adminLogin耗时: {} ms", TAG, (startTime - endTime));
return vo;
}