|
|
@@ -8,11 +8,11 @@ import com.zhentao.mapper.UserMapper;
|
|
|
import com.zhentao.mapper.UserProfileMapper;
|
|
|
import com.zhentao.mapper.UserVipMapper;
|
|
|
import com.zhentao.service.UserProfileService;
|
|
|
+import com.zhentao.service.UserService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.Period;
|
|
|
@@ -35,6 +35,9 @@ public class UserProfileServiceImpl implements UserProfileService {
|
|
|
|
|
|
@Autowired
|
|
|
private UserVipMapper userVipMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> getUserProfile(Long userId) {
|
|
|
@@ -201,6 +204,10 @@ public class UserProfileServiceImpl implements UserProfileService {
|
|
|
userProfile.setAuthenticityScore(score);
|
|
|
|
|
|
result = userProfileMapper.insert(userProfile);
|
|
|
+ UpdateWrapper updateWrapper = new UpdateWrapper();
|
|
|
+ updateWrapper.set("nickname",userProfile.getNickname());
|
|
|
+ updateWrapper.eq("user_id",userProfile.getUserId());
|
|
|
+ userMapper.update(null,updateWrapper);
|
|
|
System.out.println("新增用户扩展信息 - 用户ID: " + userProfile.getUserId() + ", 初始评分: " + score);
|
|
|
} else {
|
|
|
// 存在则更新 - 创建完整的更新对象
|
|
|
@@ -286,6 +293,10 @@ public class UserProfileServiceImpl implements UserProfileService {
|
|
|
|
|
|
// 然后使用updateById更新其他字段(会自动忽略null值,但我们已经用UpdateWrapper更新了省市区)
|
|
|
result = userProfileMapper.updateById(userProfile);
|
|
|
+ UpdateWrapper updateWrapper2 = new UpdateWrapper();
|
|
|
+ updateWrapper2.set("nickname",userProfile.getNickname());
|
|
|
+ updateWrapper2.eq("user_id",userProfile.getUserId());
|
|
|
+ userMapper.update(null,updateWrapper2);
|
|
|
System.out.println("✅ 更新user_profile表 - 用户ID: " + userProfile.getUserId() + ", 更新后评分: " + score + ", 影响行数: " + result);
|
|
|
}
|
|
|
|