修改小程序用户信息报错问题

This commit is contained in:
yuyang 2022-03-02 11:44:09 +08:00
parent d5bfa1ccc5
commit 376f3bd4f7

View File

@ -430,56 +430,59 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
*/
@Override
public AjaxResult appInfo(HttpServletRequest request) {
LoginUser loginUser = logUserUtils.getLogUser(request);
Object version = redisService.getCacheObject("global:version");
Object servicePhone = redisService.getCacheObject("global:phone");
//根据不同的用户类型查询不同的信息
Long userid = loginUser.getUserid();
Integer userType = loginUser.getUserType();
R user = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null,loginUser.getTenantId());
if(user !=null && user.getData() !=null){
Map<String, Object> map = (Map<String, Object>)user.getData();
//发票留言板版本客服电话
Integer invoice =null;
if(UserTypeUtil.USER_TYPE.equals(userType)){
invoice = redisService.getCacheObject("global:invoice:" + UserTypeUtil.USER + userid);
}else if(UserTypeUtil.INTERNET_TYPE.equals(userType)){
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.INTERNET+userid);
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.COMMUNIT+userid);
try{
LoginUser loginUser = logUserUtils.getLogUser(request);
Object version = redisService.getCacheObject("global:version");
Object servicePhone = redisService.getCacheObject("global:phone");
//根据不同的用户类型查询不同的信息
Long userid = loginUser.getUserid();
Integer userType = loginUser.getUserType();
R user = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null,loginUser.getTenantId());
if(user !=null && user.getData() !=null){
Map<String, Object> map = (Map<String, Object>)user.getData();
//发票留言板版本客服电话
Integer invoice =null;
if(UserTypeUtil.USER_TYPE.equals(userType)){
invoice = redisService.getCacheObject("global:invoice:" + UserTypeUtil.USER + userid);
}else if(UserTypeUtil.INTERNET_TYPE.equals(userType)){
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.INTERNET+userid);
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.COMMUNIT+userid);
}else{
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.CUSTOMERS+userid);
}
if(invoice==null){
map.put("invoiceNumber","0");
}else{
map.put("invoiceNumber",invoice);
}
Integer guestbook =null;
if(UserTypeUtil.USER_TYPE.equals(userType)){
guestbook = redisService.getCacheObject("userNotReadMessageCount:"+UserTypeUtil.USER_TYPE + ":" + map.get("phone").toString() + ":0:" + loginUser.getTenantId());
}else if(UserTypeUtil.INTERNET_TYPE.equals(userType)){
guestbook = redisService.getCacheObject("userNotReadMessageCount:"+UserTypeUtil.INTERNET_TYPE + ":" + map.get("phone").toString() + ":0:" + loginUser.getTenantId());
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
guestbook = redisService.getCacheObject("userNotReadMessageCount:"+UserTypeUtil.COMMUNIT_TYPE + ":" + map.get("account").toString() + ":0:" + loginUser.getTenantId());
}else{
guestbook = redisService.getCacheObject("userNotReadMessageCount:"+UserTypeUtil.CUSTOMERS_TYPE + ":" + map.get("account").toString() + ":0:" + loginUser.getTenantId());
}
if(guestbook==null){
map.put("guestbook","0");
}else{
map.put("guestbook",guestbook);
}
map.put("version",version);
map.put("servicePhone",servicePhone);
map.put("activity",0);
map.put("activitySize",1);
map.put("activityImg","https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/bunengshanchu/1.png");
map.put("socSize",redisService.getCacheObject("global:SOC"));
return AjaxResult.success(map);
}else{
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.CUSTOMERS+userid);
return AjaxResult.error("请重新登录",HttpStatus.USER_LOGIN);
}
if(invoice==null){
map.put("invoiceNumber","0");
}else{
map.put("invoiceNumber",invoice);
}
Integer guestbook =null;
if(UserTypeUtil.USER_TYPE.equals(userType)){
guestbook = redisService.getCacheObject("userNotReadMessageCount:"+UserTypeUtil.USER_TYPE + ":" + map.get("phone").toString() + ":0:" + loginUser.getTenantId());
}else if(UserTypeUtil.INTERNET_TYPE.equals(userType)){
guestbook = redisService.getCacheObject("userNotReadMessageCount:"+UserTypeUtil.INTERNET_TYPE + ":" + map.get("phone").toString() + ":0:" + loginUser.getTenantId());
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
guestbook = redisService.getCacheObject("userNotReadMessageCount:"+UserTypeUtil.COMMUNIT_TYPE + ":" + map.get("account").toString() + ":0:" + loginUser.getTenantId());
}else{
guestbook = redisService.getCacheObject("userNotReadMessageCount:"+UserTypeUtil.CUSTOMERS_TYPE + ":" + map.get("account").toString() + ":0:" + loginUser.getTenantId());
}
if(guestbook==null){
map.put("guestbook","0");
}else{
map.put("guestbook",guestbook);
}
map.put("version",version);
map.put("servicePhone",servicePhone);
map.put("activity",0);
map.put("activitySize",1);
map.put("activityImg","https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/bunengshanchu/1.png");
map.put("socSize",redisService.getCacheObject("global:SOC"));
return AjaxResult.success(map);
}else{
return AjaxResult.error("请重新登录");
}catch (Exception e){
return AjaxResult.error("请重新登录",HttpStatus.USER_LOGIN);
}
}