Commit b5ad5a04 authored by minminyan's avatar minminyan

修改日志信息,打印error

parent 47e249b9
...@@ -28,9 +28,8 @@ import com.fasterxml.jackson.core.type.TypeReference; ...@@ -28,9 +28,8 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.weibo.api.motan.config.springsupport.annotation.MotanService; import com.weibo.api.motan.config.springsupport.annotation.MotanService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -44,11 +43,9 @@ import java.util.Random; ...@@ -44,11 +43,9 @@ import java.util.Random;
/** /**
* Created by 11 on 2017/2/27. * Created by 11 on 2017/2/27.
*/ */
@Slf4j
@MotanService(export = "userMotan:8002", registry = "registryConfig") @MotanService(export = "userMotan:8002", registry = "registryConfig")
public class MotanUserServiceImpl implements UserMotanService, IBaseController { public class MotanUserServiceImpl implements UserMotanService, IBaseController {
private static final Logger LOGGER = LoggerFactory.getLogger(MotanUserServiceImpl.class);
private static final ObjectMapper MAPPER = new ObjectMapper(); private static final ObjectMapper MAPPER = new ObjectMapper();
static { static {
...@@ -214,7 +211,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController { ...@@ -214,7 +211,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController {
try { try {
userDetail.setGender(idCardService.getIdCardInfo(userDetailUpdateBean.getIdNo()).getGender()); userDetail.setGender(idCardService.getIdCardInfo(userDetailUpdateBean.getIdNo()).getGender());
} catch (ParseException e) { } catch (ParseException e) {
LOGGER.error("根据身份证获取性别出错,错误信息:" + e); log.error("根据身份证获取性别出错,userDetailUpdateBean:{}", JSON.toJSONString(userDetailUpdateBean), e);
return returnValue(null, "根据身份证获取性别出错."); return returnValue(null, "根据身份证获取性别出错.");
} }
userDetail.setEmail(userDetailUpdateBean.getEmail()); userDetail.setEmail(userDetailUpdateBean.getEmail());
...@@ -249,7 +246,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController { ...@@ -249,7 +246,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController {
} }
String requestIp = IPUtil.getRemoteIP(request); String requestIp = IPUtil.getRemoteIP(request);
LOGGER.info("第三方用户登录, loginFrom:{}, requestIp:{}", appLoginParam.getRegisterFrom(), requestIp); log.info("第三方用户登录, loginFrom:{}, requestIp:{}", appLoginParam.getRegisterFrom(), requestIp);
User user = userService.findByPhoneInDb(appLoginParam.getPhoneNo()); User user = userService.findByPhoneInDb(appLoginParam.getPhoneNo());
if (user == null) { if (user == null) {
user = register(appLoginParam.getRegisterFrom(), appLoginParam.getPhoneNo(), appLoginParam.getIdNo(), appLoginParam.getName()); user = register(appLoginParam.getRegisterFrom(), appLoginParam.getPhoneNo(), appLoginParam.getIdNo(), appLoginParam.getName());
...@@ -277,7 +274,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController { ...@@ -277,7 +274,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController {
context.setAppChannel(appLoginParam.getAppChannel()); context.setAppChannel(appLoginParam.getAppChannel());
loginInfo.setLoginContext(context); loginInfo.setLoginContext(context);
LOGGER.info("第三方用户获取信息登录成功, loginFrom:{}, phoneNo:{},appChannel:{}", appLoginParam.getRegisterFrom(), appLoginParam.getPhoneNo(), appLoginParam.getAppChannel()); log.info("第三方用户获取信息登录成功, loginFrom:{}, phoneNo:{},appChannel:{}", appLoginParam.getRegisterFrom(), appLoginParam.getPhoneNo(), appLoginParam.getAppChannel());
XLoginInfo xLoginInfo = convertObject(JSON.toJSONString(loginInfo), new TypeReference<XLoginInfo>() { XLoginInfo xLoginInfo = convertObject(JSON.toJSONString(loginInfo), new TypeReference<XLoginInfo>() {
}); });
return returnValue(xLoginInfo, ""); return returnValue(xLoginInfo, "");
...@@ -290,7 +287,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController { ...@@ -290,7 +287,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController {
} }
return MAPPER.readValue(json, typeReference); return MAPPER.readValue(json, typeReference);
} catch (Exception ex) { } catch (Exception ex) {
LOGGER.error("用户信息转换出错,错误信息{}", ex); log.error("用户信息转换出错,json:{}", json, ex);
return null; return null;
} }
...@@ -299,7 +296,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController { ...@@ -299,7 +296,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController {
@Override @Override
public void updateUserQQ(String qq, Long userId) { public void updateUserQQ(String qq, Long userId) {
if (StringUtils.isEmpty(qq) || userId == null || userId == 0L) { if (StringUtils.isEmpty(qq) || userId == null || userId == 0L) {
LOGGER.error("QQ或用户id非法,不允许修改:qq{}, userid:{}", qq, userId); log.error("QQ或用户id非法,不允许修改:qq{}, userid:{}", qq, userId);
return; return;
} }
userDetailService.updateUserQQ(userId, qq); userDetailService.updateUserQQ(userId, qq);
...@@ -327,8 +324,8 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController { ...@@ -327,8 +324,8 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController {
try { try {
contactList = MAPPER.readValue(jsonContacts, new TypeReference<List<Contact>>() { contactList = MAPPER.readValue(jsonContacts, new TypeReference<List<Contact>>() {
}); });
} catch (IOException e) { } catch (Exception e) {
LOGGER.error("联系人列表转换错误:{}", e.getMessage()); log.error("联系人列表转换错误", e);
return returnValue(null, "联系人转换错误"); return returnValue(null, "联系人转换错误");
} }
Timestamp now = new Timestamp(System.currentTimeMillis()); Timestamp now = new Timestamp(System.currentTimeMillis());
...@@ -506,7 +503,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController { ...@@ -506,7 +503,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController {
String uuid = lkbUserService.registerApp(phoneNo, randomCode); String uuid = lkbUserService.registerApp(phoneNo, randomCode);
Timestamp currentTime = new Timestamp(System.currentTimeMillis()); Timestamp currentTime = new Timestamp(System.currentTimeMillis());
LOGGER.info("第三方登录用户,保存 User"); log.info("第三方登录用户,保存 User");
User user = new User(); User user = new User();
user.setRegisteredFrom(registerFrom); user.setRegisteredFrom(registerFrom);
...@@ -520,12 +517,10 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController { ...@@ -520,12 +517,10 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController {
if (registerFrom != 645L) { if (registerFrom != 645L) {
smsService.sendAfterRegister(phoneNo); smsService.sendAfterRegister(phoneNo);
LOGGER.info("第三方登录用户注册成功, registerFrom:{}, phoneNo:{}, 并且已发送短信通知", registerFrom, phoneNo); log.info("第三方登录用户注册成功, registerFrom:{}, phoneNo:{},idNo:{},name:{} 并且已发送短信通知", registerFrom, phoneNo, idNo, name);
} }
if (org.apache.commons.lang3.StringUtils.isNotEmpty(idNo) && org.apache.commons.lang3.StringUtils.isNotEmpty(name)) { if (StringUtils.isNotEmpty(idNo) && StringUtils.isNotEmpty(name)) {
LOGGER.info("第三方登录用户,保存 UserDetail");
IdCardInfo cardInfo; IdCardInfo cardInfo;
try { try {
cardInfo = idCardService.getIdCardInfoWithExceptions(idNo); cardInfo = idCardService.getIdCardInfoWithExceptions(idNo);
...@@ -543,7 +538,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController { ...@@ -543,7 +538,7 @@ public class MotanUserServiceImpl implements UserMotanService, IBaseController {
lkbUserService.userUpdate(user.getUuid(), name, idNo); lkbUserService.userUpdate(user.getUuid(), name, idNo);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("保存 UserDetail 出现异常", e); log.error("保存 UserDetail 出现异常", e);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment