git 5 anos atrás
pai
commit
0c9a9db73b

+ 14 - 0
core/src/main/java/com/mooctest/crowd/domain/model/UserPO.java

@@ -3,6 +3,7 @@ package com.mooctest.crowd.domain.model;
 import lombok.Data;
 
 import javax.persistence.*;
+import java.sql.Date;
 import java.sql.Timestamp;
 
 /**
@@ -55,4 +56,17 @@ public class UserPO {
     @Column(name = "U_CREATE_TIME")
     private Timestamp createTime;
 
+    @Column(name="U_BIRTHDAY")
+    private Date birthday;
+
+    @Column(name="U_DETAILED_ADDRESS")
+    private String  detailedAddress;
+
+    @Column(name="U_PERSONAL_COMPETENCE")
+    private String personalCompetence;
+
+    @Column(name="U_UNIT")
+    private String unit;
+
+
 }

+ 24 - 0
site/src/main/java/com/mooctest/crowd/site/controller/PersonalDataController.java

@@ -0,0 +1,24 @@
+package com.mooctest.crowd.site.controller;
+
+
+import com.mooctest.crowd.site.data.dto.UserDTO;
+import com.mooctest.crowd.site.service.PersonalDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+
+@RestController
+@RequestMapping("/api/personal")
+public class PersonalDataController {
+
+    @Autowired
+    private PersonalDataService personalDataService;
+
+    @RequestMapping(value = "/display/{userId:\\d+}", method = RequestMethod.GET)
+    public UserDTO getInformation(@PathVariable("userId") long userId){
+        return  personalDataService.getInformation(userId);
+    }
+}

+ 6 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/UserVO.java

@@ -6,6 +6,8 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.springframework.beans.BeanUtils;
 
+import java.sql.Date;
+
 /**
  * @Author: xuexb
  * @Date: 2019.7.15 20:41
@@ -26,6 +28,10 @@ public class UserVO {
     private Double allProjectPrice;
     private String authType;
     private Long taskCount;
+    private Date birthday;
+    private String detailedAddress;
+    private String personalCompetence;
+    private String unit;
 
     public UserVO(User user){
         BeanUtils.copyProperties(user, this);

+ 1 - 4
site/src/main/java/com/mooctest/crowd/site/mediator/ViewMediator.java

@@ -69,8 +69,5 @@ public interface ViewMediator {
 
     List<TechnicalArticlesVO>  articlesRanking();
 
-    UserVO getinformation(long userId);
-
-
-
+    UserDTO getInformation(long userId);
 }

+ 11 - 3
site/src/main/java/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.java

@@ -742,15 +742,23 @@ public class WebMediatorImpl implements ViewMediator {
     }
 
     @Override
-    public UserVO getinformation(long userId) {
+    public UserDTO getInformation(long userId) {
+        UserDTO userDTO=new UserDTO();
         Optional<UserPO> userPO = userDao.findById(userId);
         if (userPO.isPresent()) {
             UserVO userVO = new UserVO();
+            userVO.setPhotoUrl(userPO.get().getPhotoUrl());
             userVO.setName(userPO.get().getName());
             userVO.setUserName(userPO.get().getUserName());
+            userVO.setUnit(userPO.get().getUnit());
             userVO.setGender(userPO.get().getGender());
-            userVO.setEmail(userPO.get().getEmail());
-            return userVO;
+            userVO.setBirthday(userPO.get().getBirthday());
+            userVO.setProvince(userPO.get().getProvince());
+            userVO.setCity(userPO.get().getCity());
+            userVO.setDetailedAddress(userPO.get().getDetailedAddress());
+            userVO.setPersonalCompetence(userPO.get().getPersonalCompetence());
+            userDTO.setUserVO(userVO);
+            return userDTO;
         }
         return null;
     }

+ 8 - 0
site/src/main/java/com/mooctest/crowd/site/service/PersonalDataService.java

@@ -0,0 +1,8 @@
+package com.mooctest.crowd.site.service;
+
+import com.mooctest.crowd.site.data.dto.UserDTO;
+
+
+public interface PersonalDataService {
+    UserDTO getInformation(long id);
+}

+ 20 - 0
site/src/main/java/com/mooctest/crowd/site/service/impl/PersonalDataServiceImpl.java

@@ -0,0 +1,20 @@
+package com.mooctest.crowd.site.service.impl;
+
+import com.mooctest.crowd.site.data.dto.UserDTO;
+import com.mooctest.crowd.site.data.vo.UserVO;
+import com.mooctest.crowd.site.mediator.ViewMediator;
+import com.mooctest.crowd.site.service.PersonalDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PersonalDataServiceImpl implements PersonalDataService {
+
+    @Autowired
+    private ViewMediator viewMediator;
+
+    @Override
+    public UserDTO getInformation(long id) {
+        return viewMediator.getInformation(id);
+    }
+}