From 38efbb4a62ccdd98e4122fc879dd230795ef8ce3 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 19 Nov 2021 15:51:30 +0800
Subject: [PATCH] 20211119
---
gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java b/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
index f61ca1a..ad08667 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
@@ -3,6 +3,7 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -101,8 +102,19 @@
String userId = jhyInfoListVo.getUserId();
if(StrUtil.isNotEmpty(userId)){
AccountInfo accountInfo = accountMapper.selectOneByUserId(userId);
- String collectScore = StrUtil.isEmpty(accountInfo.getCollectScore()) ? "0" : accountInfo.getCollectScore();
- jhyInfoListVo.setScore(new BigDecimal(collectScore).setScale( 2, BigDecimal.ROUND_DOWN ));
+ if(ObjectUtil.isNotEmpty(accountInfo)){
+ String collectScore = StrUtil.isEmpty(accountInfo.getCollectScore()) ? "0" : accountInfo.getCollectScore();
+ jhyInfoListVo.setScore(new BigDecimal(collectScore).setScale( 2, BigDecimal.ROUND_DOWN ));
+ }
+
+ Example example = new Example(UserLoginInfo.class);
+ Example.Criteria criteria = example.createCriteria();
+ criteria.andEqualTo("userId", userId);
+ example.setOrderByClause("login_time desc");
+ List<UserLoginInfo> userLoginInfos = userLoginInfoMapper.selectByExample(example);
+ if (CollUtil.isNotEmpty(userLoginInfos)) {
+ jhyInfoListVo.setLastLogintime(CollUtil.getFirst(userLoginInfos).getLoginTime());
+ }
}
}
}
@@ -177,9 +189,13 @@
viewJhyInfoVo.setAddress(jhyInfo.getAddress());
String userId = jhyInfo.getUserId();
AccountInfo accountInfo = accountMapper.selectOneByUserId(userId);
- String collectScore = accountInfo.getCollectScore();
- BigDecimal bigDecimal = new BigDecimal(StrUtil.isEmpty(collectScore) ? "0" : collectScore).setScale( 2, BigDecimal.ROUND_DOWN );
- viewJhyInfoVo.setScore(bigDecimal);
+ if(ObjectUtil.isNotEmpty(accountInfo)){
+ String collectScore = accountInfo.getCollectScore();
+ BigDecimal bigDecimal = new BigDecimal(StrUtil.isEmpty(collectScore) ? "0" : collectScore).setScale( 2, BigDecimal.ROUND_DOWN );
+ viewJhyInfoVo.setScore(bigDecimal);
+
+ }
+
viewJhyInfoVo.setCreateTime(jhyInfo.getCreatedTime().toString());
UserInfo userInfo = userMapper.selectByPrimaryKey(userId);
--
Gitblit v1.9.1