Browse Source

用户信息接口修改

ZhangWenQiang 6 years ago
parent
commit
c6cb468d18

+ 23 - 0
happy-boot-module-hppay/src/main/java/org/jeecg/modules/user/service/impl/UserServiceImpl.java

@@ -20,6 +20,7 @@ import org.jeecg.modules.user.mapper.UserMapper;
 import org.jeecg.modules.user.service.IUserService;
 import org.jeecg.modules.util.TokenUtil;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
@@ -50,6 +51,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     private IMessageService messageService;
     @Resource
     private CompanyAuthenticationMapper companyAuthenticationMapper;
+    @Value("${jeecg.oss.aliyunUrl}")
+    private String savePath;
 
 
     @Override
@@ -135,6 +138,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
 
         //更新用户
         this.updateById(user1);
+        user1 = this.getById(user1.getId());
         //清空验证码缓存
         redisUtil.del(phone);
         returnMap.put("userInfo", user1);
@@ -230,6 +234,16 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                 user.setAuthenticationStatus(1);
                 user.setUpdateTime(new Date());
                 this.updateById(user);
+                user = this.getById(user.getId());
+                if (!user.getHeadImgUrl().contains("http")) {
+                    user.setHeadImgUrl(savePath + user.getHeadImgUrl());
+                }
+                if (!user.getIdCardBack().contains("http")) {
+                    user.setIdCardBack(savePath + user.getIdCardBack());
+                }
+                if (!user.getIdCardFront().contains("http")) {
+                    user.setIdCardFront(savePath + user.getIdCardFront());
+                }
                 returnMap.put("userInfo", user);
             }
 
@@ -293,6 +307,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             if (companyAuthenticationList.size() > 0) {
                 companyAuthentication1 = companyAuthenticationList.get(0);
             }
+            if (!user.getHeadImgUrl().contains("http")) {
+                user.setHeadImgUrl(savePath + user.getHeadImgUrl());
+            }
+            if (!user.getIdCardBack().contains("http")) {
+                user.setIdCardBack(savePath + user.getIdCardBack());
+            }
+            if (!user.getIdCardFront().contains("http")) {
+                user.setIdCardFront(savePath + user.getIdCardFront());
+            }
             returnMap.put("userInfo", user);
             returnMap.put("companyAuthentication", companyAuthentication1);
         } else {