Bläddra i källkod

Merge branch 'feature-V2.0' of ssh://git.mooctest.com:1022/crowd-2019/crowd-test-service-backend into feature-V2.0

guo00guo 5 år sedan
förälder
incheckning
2b109b2ce2

+ 2 - 1
core/src/main/java/com/mooctest/crowd/domain/dao/UserDao.java

@@ -2,13 +2,14 @@ package com.mooctest.crowd.domain.dao;
 
 import com.mooctest.crowd.domain.model.UserPO;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.CrudRepository;
 import org.springframework.data.repository.PagingAndSortingRepository;
 
 import javax.transaction.Transactional;
 import java.util.Optional;
 
 @Transactional
-public interface UserDao extends PagingAndSortingRepository<UserPO, Long>, JpaSpecificationExecutor<UserPO> {
+public interface UserDao extends PagingAndSortingRepository<UserPO, Long>, JpaSpecificationExecutor<UserPO> ,CrudRepository<UserPO, Long> {
 
     UserPO findByMobile(String mobile);
 

+ 5 - 18
core/src/main/java/com/mooctest/crowd/domain/domainobject/PersonalAuthentication.java

@@ -11,13 +11,15 @@ import java.sql.Timestamp;
  * @date 2019-08-19 15:47
  */
 @Data
-public class PersonalAuthentication {
+public class PersonalAuthentication{
 
     private Long id;
     private Long userId;
     private String realName;
     private String IDCard;
-    private String IDCardPhoto;
+    private String IDCardPostivePhoto;//身份证正面照片
+    private String IDCardBackPhoto;//身份证反面照片
+    private String sex;
     private String bankAccount;
     private String address;
     private int isDeleted;
@@ -26,22 +28,7 @@ public class PersonalAuthentication {
     private Timestamp applyTime;
     private Timestamp checkTime;
 
-    @Override
-    public String toString() {
-        return "PersonalAuth{" +
-                "id=" + id +
-                ", userId=" + userId +
-                ", realName='" + realName + '\'' +
-                ", IDCard='" + IDCard + '\'' +
-                ", IDCardPhoto='" + IDCardPhoto + '\'' +
-                ", bankAccount='" + bankAccount + '\'' +
-                ", address='" + address + '\'' +
-                ", isAuthentication='" + isAuthentication + '\'' +
-                ", explain=" + explain +
-                ", applyTime='" + applyTime + '\'' +
-                ", checkTime='" + checkTime + '\'' +
-                '}';
-    }
+
 
     public PersonalAuthentication applyAuthentication(Long userId) {
         this.setUserId(userId);

+ 16 - 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,19 @@ 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;
+
+    @Column(name="U_COUNTY")
+    private String county;
+
 }

+ 17 - 5
site/src/main/java/com/mooctest/crowd/site/command/ApplyPersonalAuthCommand.java

@@ -22,22 +22,34 @@ public class ApplyPersonalAuthCommand {
     @NotNull(message = "请填写真实姓名")
     private String realName;
 
+    @NotNull(message = "请选择性别")
+    private String sex;
+
     @JsonProperty(value = "IDCard")
     @NotNull(message = "请填写身份证号码")
     @Pattern(regexp = "\\d{15}(\\d{2}[0-9xX])?", message = "身份证号格式错误")
     private String IDCard;
 
-    @JsonProperty(value = "IDCardPhoto")
-    @NotNull(message = "请上传身份证图片")
-    private String IDCardPhoto;
+    @JsonProperty(value = "IDCardPositivePhoto")
+    @NotNull(message = "请上传身份证正面图片")
+    private String IDCardPositivePhoto;
+
+    @JsonProperty(value = "IDCardBackPhoto")
+    @NotNull(message = "请上传身份证反面图片")
+    private String IDCardBackPhoto;
+
+    @JsonProperty(value = "IDCardDeadTime")
+    @NotNull(message = "请正确填写过期时间")
+    private Timestamp IDCardDeadTime;
+
 
     @NotNull(message = "请填写银行卡号")
     private String bankAccount;
 
-    @NotNull(message = "地址不可为空")
+    @NotNull(message = "请填写单位或者家庭地址")
     private String address;
 
-    public PersonalAuthentication toPersonalAuth(){
+    public PersonalAuthentication toPersonalAuth() {
         PersonalAuthentication personalAuthentication = new PersonalAuthentication();
         BeanUtils.copyProperties(this, personalAuthentication);
         personalAuthentication.setApplyTime(new Timestamp(System.currentTimeMillis()));

+ 26 - 30
site/src/main/java/com/mooctest/crowd/site/controller/CrowTestSquareController.java

@@ -1,13 +1,11 @@
 package com.mooctest.crowd.site.controller;
 
 import com.google.gson.Gson;
-import com.mooctest.crowd.domain.domainobject.DeletedStatus;
 import com.mooctest.crowd.site.constants.CommonConstant;
 import com.mooctest.crowd.site.data.dto.CrowdTestSquareIndexDTO;
 import com.mooctest.crowd.site.data.dto.ProjectAndTaskDTO;
 import com.mooctest.crowd.site.data.response.ResponseVO;
 import com.mooctest.crowd.site.data.response.ServerCode;
-import com.mooctest.crowd.site.data.vo.CrowdProjectVO;
 import com.mooctest.crowd.site.data.vo.CrowdTaskVO;
 import com.mooctest.crowd.site.data.vo.CrowdTestProjectVO;
 import com.mooctest.crowd.site.data.vo.SearchConditionVO;
@@ -20,10 +18,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.domain.Sort;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -37,7 +32,7 @@ import java.util.List;
 
 @RestController
 @RequestMapping("/api/square")
-public class CrowTestSquareController {
+public class CrowTestSquareController extends  BaseController{
 
     @Autowired
     private CrowdProjectService crowdProjectService;
@@ -67,12 +62,12 @@ public class CrowTestSquareController {
      * 众测项目分页查询接口
      */
     @GetMapping("/project/list")
-    public ResponseVO findAllprojectByPage(@RequestParam(name = "searchCondition") String searchCondition){
+    public ResponseVO findAllprojectByPage(@RequestParam(name = "searchCondition") String searchCondition) {
         Gson gson = new Gson();
         SearchConditionVO searchConditionVO = gson.fromJson(searchCondition, SearchConditionVO.class);
         Pageable pageable = this.getPageable(searchConditionVO);
         String keyword = searchConditionVO.getKeyword();
-       List<CrowdTestProjectVO> list = crowdProjectService.findAll(pageable);
+        List<CrowdTestProjectVO> list = crowdProjectService.findAll(pageable);
         Page<CrowdTestProjectVO> page = DataUtils.listToPage(list, pageable);
         return new ResponseVO<>(ServerCode.SUCCESS, page);
     }
@@ -93,27 +88,28 @@ public class CrowTestSquareController {
     /**
      * 搜索框模糊查询接口
      */
-    @GetMapping("search/list")
-    public ResponseVO<Page<ProjectAndTaskDTO>> findByNameLike(@RequestParam("searchCondition") String searchCondition,
-                                                              @RequestParam("pageNum") int pageNum,
-                                                              @RequestParam("pageSize") int pageSize){
-        ProjectAndTaskDTO projectAndTaskDTO = new ProjectAndTaskDTO();
-        List<CrowdTestProjectVO> list = crowdProjectService.findByNameLike(searchCondition);
-        List<CrowdTaskVO> taskVOList = crowdTaskService.findByNameLike(searchCondition);
-        projectAndTaskDTO.setCrowdTaskVOList(taskVOList);
-        projectAndTaskDTO.setProjectVOList(list);
-        List projectAndTaskDTOList = new ArrayList<>();
-        projectAndTaskDTOList.addAll(list);
-        projectAndTaskDTOList.addAll(taskVOList);
-        Pageable pageable = PageRequest.of(pageNum - 1, pageSize);
-        Page<ProjectAndTaskDTO> projectAndTaskDTOPage = DataUtils.listToPage(projectAndTaskDTOList, pageable);
-        return new ResponseVO<>(ServerCode.SUCCESS, projectAndTaskDTOPage);
-    }
-
-    Pageable getPageable(SearchConditionVO searchConditionVO){
-        int activePage = searchConditionVO.getActivePage() == 0?1:searchConditionVO.getActivePage();
-        Sort sort = new Sort(Sort.Direction.DESC,"id");
-        return new PageRequest(activePage-1, CommonConstant.DEFAULT_ROWS_ON_PAGE, sort);
+    @PostMapping("search/list")
+    public ResponseVO<Page<ProjectAndTaskDTO>> findByNameLike(@RequestParam("searchCondition")String searchCondition){
+            Gson gson = new Gson();
+            SearchConditionVO searchConditionVO = gson.fromJson(searchCondition, SearchConditionVO.class);
+            Pageable pageable = this.getPageable(searchConditionVO);
+            String keyword = searchConditionVO.getKeyword();
+            ProjectAndTaskDTO projectAndTaskDTO = new ProjectAndTaskDTO();
+            List<CrowdTestProjectVO> list = crowdProjectService.findByNameLike(keyword);
+            List<CrowdTaskVO> taskVOList = crowdTaskService.findByNameLike(keyword);
+            projectAndTaskDTO.setCrowdTaskVOList(taskVOList);
+            projectAndTaskDTO.setProjectVOList(list);
+            List projectAndTaskDTOList = new ArrayList<>();
+            projectAndTaskDTOList.addAll(list);
+            projectAndTaskDTOList.addAll(taskVOList);
+            Page<ProjectAndTaskDTO> projectAndTaskDTOPage = DataUtils.listToPage(projectAndTaskDTOList, pageable);
+            return new ResponseVO<>(ServerCode.SUCCESS, projectAndTaskDTOPage);
+        }
+
+    Pageable getPageable(SearchConditionVO searchConditionVO) {
+        int activePage = searchConditionVO.getActivePage() == 0 ? 1 : searchConditionVO.getActivePage();
+        Sort sort = new Sort(Sort.Direction.DESC, "id");
+        return new PageRequest(activePage - 1, CommonConstant.DEFAULT_ROWS_ON_PAGE, sort);
     }
 
 }

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

@@ -0,0 +1,27 @@
+package com.mooctest.crowd.site.controller;
+
+
+import com.mooctest.crowd.site.data.dto.UserDTO;
+import com.mooctest.crowd.site.data.vo.UserVO;
+import com.mooctest.crowd.site.service.PersonalDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+@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);
+    }
+
+    @RequestMapping(value = "/update/{userId:\\d+}", method = RequestMethod.PUT)
+    public UserDTO addUserToGroup(@PathVariable("userId") long userId, @RequestBody UserVO userVO) {
+        return  personalDataService.updateInformation(userId,userVO);
+    }
+}

+ 9 - 12
site/src/main/java/com/mooctest/crowd/site/controller/TechnicalArticlesController.java

@@ -9,15 +9,13 @@ import com.mooctest.crowd.site.data.vo.SearchConditionVO;
 import com.mooctest.crowd.site.data.vo.TechnicalArticlesVO;
 import com.mooctest.crowd.site.service.TechnicalArticlesService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.domain.Sort;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+
 
 /**
  * @Author: hanyuwei
@@ -30,15 +28,14 @@ public class TechnicalArticlesController {
     @Autowired
     private TechnicalArticlesService technical;
 
-//    @RequestMapping(value = "/articles", method = RequestMethod.POST)
-//    public ResponseVO<TechnicalArticlesDTO> technicalarticles(@RequestBody SearchConditionVO searchConditionVO){
-//        Map<String, String> extraCondition = searchConditionVO.getColumnFilters()==null? new HashMap<>() :super.getExtraCondition(searchConditionVO);
-//        Gson gson = new Gson();
-//        SearchConditionVO searchConditionVO = gson.fromJson(searchCondition, SearchConditionVO.class);
-//        Pageable pageable = this.getPageable(searchConditionVO);
-//        String keyword = searchConditionVO.getKeyword();
-//        return new ResponseVO<>(ServerCode.SUCCESS, technical.getArticles(pageable, keyword));
-//    }
+    @RequestMapping(value = "/articles", method = RequestMethod.GET)
+    public ResponseVO<TechnicalArticlesDTO> technicalarticles(@RequestParam(name = "searchCondition") String searchCondition){
+        Gson gson = new Gson();
+        SearchConditionVO searchConditionVO = gson.fromJson(searchCondition, SearchConditionVO.class);
+        Pageable pageable = this.getPageable(searchConditionVO);
+        String keyword = searchConditionVO.getKeyword();
+        return new ResponseVO<>(ServerCode.SUCCESS, technical.getArticles(pageable, keyword));
+    }
 
     Pageable getPageable(SearchConditionVO searchConditionVO){
         int activePage = searchConditionVO.getActivePage() == 0?1:searchConditionVO.getActivePage();

+ 42 - 28
site/src/main/java/com/mooctest/crowd/site/controller/UserController.java

@@ -13,11 +13,14 @@ import com.mooctest.crowd.site.data.vo.BaseAuthVO;
 import com.mooctest.crowd.site.data.vo.EnterpriseAuthVO;
 import com.mooctest.crowd.site.data.vo.PersonalAuthVO;
 import com.mooctest.crowd.site.service.UserService;
+import org.apache.juli.logging.Log;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpRequest;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 import java.util.List;
 
@@ -28,7 +31,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/api")
-public class UserController {
+public class UserController extends BaseController {
 
     @Autowired
     private UserService userService;
@@ -41,27 +44,27 @@ public class UserController {
     }
 
     @RequestMapping(value = "/user", method = RequestMethod.PUT)
-    public UserDTO updateUser(@Validated UserUpdateCommand command, BindingResult result){
+    public UserDTO updateUser(@Validated UserUpdateCommand command, BindingResult result) {
         return null;
     }
 
     @RequestMapping(value = "/user/{userId}", method = RequestMethod.DELETE)
-    public boolean deleteUser(@PathVariable("userId") Long userId){
+    public boolean deleteUser(@PathVariable("userId") Long userId) {
         return true;
     }
 
     @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET)
-    public UserDTO getUser(@PathVariable Long userId){
+    public UserDTO getUser(@PathVariable Long userId) {
         return userService.getUser(userId);
     }
 
     @RequestMapping(value = "/user", method = RequestMethod.GET)
-    public List<UserDTO> getUsers(){
+    public List<UserDTO> getUsers() {
         return null;
     }
 
     @RequestMapping(value = "/login", method = RequestMethod.GET)
-    public UserDTO loginByMobileAndPwd(@Validated LoginCommand loginCommand, BindingResult result) throws PasswordErrorException, AccountNotExistException, BadRequestException {
+    public UserDTO loginByMobileAndPwd(@Validated @RequestBody LoginCommand loginCommand, BindingResult result, HttpServletRequest request) throws PasswordErrorException, AccountNotExistException, BadRequestException {
         if (result.hasErrors())
             throw new BadRequestException(result.getFieldError().getDefaultMessage());
         return userService.loginByMobileAndPwd(loginCommand);
@@ -87,6 +90,7 @@ public class UserController {
 
     /**
      * 申请个人实名认证
+     *
      * @param userId
      * @param command
      * @param result
@@ -95,19 +99,20 @@ public class UserController {
      */
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/personalAuth", method = RequestMethod.POST)
-    public PersonalAuthVO applyPersonalAuthentication(@PathVariable("userId")Long userId,
+    public PersonalAuthVO applyPersonalAuthentication(@PathVariable("userId") Long userId,
                                                       @Validated @RequestBody ApplyPersonalAuthCommand command,
-                                                      BindingResult result, HttpSession session){
-        if (!userId.equals(Long.parseLong((String)session.getAttribute("userId"))))
+                                                      BindingResult result, HttpSession session) {
+
+        if (!userId.equals(Long.parseLong((String) session.getAttribute("userId"))))
             throw new UnauthorizedException("没有权限对他人账号进行操作!");
         if (result.hasErrors())
             throw new BaseException(result.getFieldError().getDefaultMessage());
-
         return userService.applyPersonalAuth(userId, command);
     }
 
     /**
      * 修改个人认证信息
+     *
      * @param userId
      * @param command
      * @param result
@@ -115,64 +120,70 @@ public class UserController {
      */
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/personalAuth", method = RequestMethod.PUT)
-    public PersonalAuthVO updatePersonalAuthInfo(@PathVariable("userId")Long userId,
+    public PersonalAuthVO updatePersonalAuthInfo(@PathVariable("userId") Long userId,
                                                  @Validated @RequestBody ApplyPersonalAuthCommand command,
                                                  HttpSession session,
-                                                 BindingResult result){
-        if (result.hasErrors())
+                                                 BindingResult result) {
+        if (result.hasErrors()) {
             throw new BaseException(result.getFieldError().getDefaultMessage());
+        }
         return userService.updatePersonalAuthInfo(userId, command);
     }
 
 
     /**
      * 个人认证:通过审核
+     *
      * @param userId
      * @return
      */
     @LoginRequired
     @SysAdminRequired
     @RequestMapping(value = "/user/{userId}/personalAuth/status/accept", method = RequestMethod.PUT)
-    public PersonalAuthVO passPersonalAuth(@PathVariable("userId") Long userId){
+    public PersonalAuthVO passPersonalAuth(@PathVariable("userId") Long userId) {
         return userService.passPersonalAuth(userId);
     }
 
     /**
      * 个人认证:审核未通过
+     *
      * @param userId
      * @return
      */
     @LoginRequired
     @SysAdminRequired
     @RequestMapping(value = "/user/{userId}/personalAuth/status/reject", method = RequestMethod.PUT)
-    public PersonalAuthVO rejectPersonalAuth(@PathVariable("userId") Long userId, @RequestBody @Validated AuthRejectCommand command){
+    public PersonalAuthVO rejectPersonalAuth(@PathVariable("userId") Long userId, @RequestBody @Validated AuthRejectCommand command) {
         return userService.rejectPersonalAuth(userId, command.getExplain());
     }
 
     /**
      * 查看个人认证信息
+     *
      * @param userId
      * @return
      */
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/personalAuth", method = RequestMethod.GET)
-    public PersonalAuthVO getPersonalAuthInfo(@PathVariable("userId") Long userId){
+    public PersonalAuthVO getPersonalAuthInfo(@PathVariable("userId") Long userId) {
         return userService.getPersonalAuthInfo(userId);
     }
 
     /**
      * 获取企业认证信息
+     *
      * @param userId
      * @return
      */
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/enterpriseAuth", method = RequestMethod.GET)
-    public EnterpriseAuthVO getEnterpriseAuthInfo(@PathVariable("userId") Long userId){
+    public EnterpriseAuthVO getEnterpriseAuthInfo(@PathVariable("userId") Long userId) {
         return userService.getEnterpriseAuthInfo(userId);
     }
 
     /**
      * 申请企业认证接口
+     *
      * @param userId
      * @param command
      * @param result
@@ -181,10 +192,10 @@ public class UserController {
      */
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/enterpriseAuth", method = RequestMethod.POST)
-    public EnterpriseAuthVO applyEnterpriseAuth(@PathVariable("userId")Long userId,
-                                                  @Validated @RequestBody ApplyEnterpriseAuthCommand command,
-                                                  BindingResult result, HttpSession session){
-        if (!userId.equals(Long.parseLong((String)session.getAttribute("userId"))))
+    public EnterpriseAuthVO applyEnterpriseAuth(@PathVariable("userId") Long userId,
+                                                @Validated @RequestBody ApplyEnterpriseAuthCommand command,
+                                                BindingResult result, HttpSession session) {
+        if (!userId.equals(Long.parseLong((String) session.getAttribute("userId"))))
             throw new UnauthorizedException("没有权限对他人账号进行操作!");
         if (result.hasErrors())
             throw new BaseException(result.getFieldError().getDefaultMessage());
@@ -193,6 +204,7 @@ public class UserController {
 
     /**
      * 更新企业认证信息
+     *
      * @param userId
      * @param command
      * @param result
@@ -200,9 +212,9 @@ public class UserController {
      */
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/enterpriseAuth", method = RequestMethod.PUT)
-    public EnterpriseAuthVO updatePersonalAuthInfo(@PathVariable("userId")Long userId,
-                                                 @Validated @RequestBody ApplyEnterpriseAuthCommand command,
-                                                 BindingResult result){
+    public EnterpriseAuthVO updatePersonalAuthInfo(@PathVariable("userId") Long userId,
+                                                   @Validated @RequestBody ApplyEnterpriseAuthCommand command,
+                                                   BindingResult result) {
         if (result.hasErrors())
             throw new BaseException(result.getFieldError().getDefaultMessage());
         return userService.updateEnterpriseAuthInfo(userId, command);
@@ -210,38 +222,40 @@ public class UserController {
 
     /**
      * 企业认证:审核通过
+     *
      * @param userId
      * @return
      */
     @LoginRequired
     @SysAdminRequired
     @RequestMapping(value = "/user/{userId}/enterpriseAuth/status/accept", method = RequestMethod.PUT)
-    public EnterpriseAuthVO passEnterpriseAuth(@PathVariable("userId") Long userId){
+    public EnterpriseAuthVO passEnterpriseAuth(@PathVariable("userId") Long userId) {
         return userService.passEnterpriseAuth(userId);
     }
 
     /**
      * 企业认证:审核未通过
+     *
      * @param userId
      * @return
      */
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/enterpriseAuth/status/reject", method = RequestMethod.PUT)
-    public EnterpriseAuthVO rejectEnterpriseAuth(@PathVariable("userId") Long userId, @RequestBody @Validated AuthRejectCommand command){
+    public EnterpriseAuthVO rejectEnterpriseAuth(@PathVariable("userId") Long userId, @RequestBody @Validated AuthRejectCommand command) {
         return userService.rejectEnterpriseAuth(userId, command.getExplain());
     }
 
     @LoginRequired
     @SysAdminRequired
     @RequestMapping(value = "/user/authentication/handling", method = RequestMethod.GET)
-    public List<BaseAuthVO> getAuthingList(){
+    public List<BaseAuthVO> getAuthingList() {
         return userService.getAuthingList();
     }
 
     @LoginRequired
     @SysAdminRequired
     @RequestMapping(value = "/user/authentication/handled", method = RequestMethod.GET)
-    public List<BaseAuthVO> getAuthedList(){
+    public List<BaseAuthVO> getAuthedList() {
         return userService.getAuthedList();
     }
 

+ 3 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/PersonalAuthVO.java

@@ -29,6 +29,9 @@ public class PersonalAuthVO {
     private Timestamp applyTime;
     private Timestamp checkTime;
     private StatusVO authStatus;
+    private String IDCardPostivePhoto;//身份证正面照片
+    private String IDCardBackPhoto;//身份证反面照片
+    private  String sex;
 
     public PersonalAuthVO(PersonalAuthentication personalAuthentication){
         BeanUtils.copyProperties(personalAuthentication, this);

+ 23 - 7
site/src/main/java/com/mooctest/crowd/site/data/vo/UserVO.java

@@ -2,10 +2,13 @@ package com.mooctest.crowd.site.data.vo;
 
 import com.mooctest.crowd.domain.domainobject.Account;
 import com.mooctest.crowd.domain.domainobject.User;
+import com.mooctest.crowd.domain.model.UserPO;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.springframework.beans.BeanUtils;
 
+import java.sql.Date;
+
 /**
  * @Author: xuexb
  * @Date: 2019.7.15 20:41
@@ -26,27 +29,40 @@ public class UserVO {
     private Double allProjectPrice;
     private String authType;
     private Long taskCount;
+    private Date birthday;
+    private String detailedAddress;
+    private String personalCompetence;
+    private String unit;
+    private String county;
 
-    public UserVO(User user){
+    public UserVO(User user) {
         BeanUtils.copyProperties(user, this);
-        this.password="********";
-        if (user.getEvaluationAgency() != null){
+        this.password = "********";
+        if (user.getEvaluationAgency() != null) {
             this.authType = "agency";
-        } else if (user.getEnterpriseAuthentication() != null){
+        } else if (user.getEnterpriseAuthentication() != null) {
             this.authType = "enterprise";
-        } else if (user.getPersonalAuthentication() != null){
+        } else if (user.getPersonalAuthentication() != null) {
             this.authType = "personal";
         } else
             this.authType = "noAuth";
     }
 
-    public void toUser(User user){
+    public void toUser(User user) {
         id = user.getId();
         name = user.getName();
         userName = user.getUserName();
     }
 
-    public UserVO(Account account){
+    public UserVO(UserPO userPO) {
+
+        BeanUtils.copyProperties(userPO, this);
+
+
+    }
+
+
+    public UserVO(Account account) {
         BeanUtils.copyProperties(account, this);
     }
 }

+ 2 - 3
site/src/main/java/com/mooctest/crowd/site/mediator/ViewMediator.java

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

+ 29 - 4
site/src/main/java/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.java

@@ -90,7 +90,7 @@ public class WebMediatorImpl implements ViewMediator {
 
     @Override
     public UserDTO loginByMobileAndPwd(LoginCommand cmd) {
-        return null;
+          return null;
     }
 
     @Override
@@ -742,19 +742,44 @@ 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.setCounty(userPO.get().getCounty());
+            userVO.setDetailedAddress(userPO.get().getDetailedAddress());
+            userVO.setPersonalCompetence(userPO.get().getPersonalCompetence());
+            userDTO.setUserVO(userVO);
+            return userDTO;
         }
         return null;
     }
 
+    @Override
+    public UserDTO updateInformation(long userId, UserVO userVO) {
+        Optional<UserPO> userPO = userDao.findById(userId);
+        userPO.get().setUnit(userVO.getUnit());
+        userPO.get().setGender(userVO.getGender());
+        userPO.get().setBirthday(userVO.getBirthday());
+        userPO.get().setProvince(userVO.getProvince());
+        userPO.get().setCity(userVO.getCity());
+        userPO.get().setCounty(userVO.getCounty());
+        userPO.get().setDetailedAddress(userVO.getDetailedAddress());
+        userPO.get().setPersonalCompetence(userVO.getPersonalCompetence());
+        userDao.save(userPO.get());
+        this.getInformation(userId);
+        return this.getInformation(userId);
+    }
+
     private ProjectOperationControl initProjectPermission(CrowdTestProject project, User user) {
         ProjectOperationControl operationControl = new ProjectOperationControl();
         if (user == null)

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

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

+ 2 - 2
site/src/main/java/com/mooctest/crowd/site/service/TechnicalArticlesService.java

@@ -2,12 +2,12 @@ package com.mooctest.crowd.site.service;
 
 import com.mooctest.crowd.site.data.dto.TechnicalArticlesDTO;
 import com.mooctest.crowd.site.data.vo.TechnicalArticlesVO;
-import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 
 import java.util.List;
 
 
+
 /**
  * @author: Diors.Po
  * @Email: 171256175@qq.com
@@ -16,7 +16,7 @@ import java.util.List;
 
 public interface TechnicalArticlesService {
 
-    TechnicalArticlesDTO getArticles(Pageable pageable, String keyword);
+    TechnicalArticlesDTO getArticles(Pageable pageable,String keyword);
 
     List<TechnicalArticlesVO> articlesRanking();
 }

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

@@ -0,0 +1,25 @@
+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);
+    }
+
+    @Override
+    public UserDTO updateInformation(long userId, UserVO userVO) {
+        return viewMediator.updateInformation(userId,userVO);
+    }
+}

+ 1 - 1
site/src/main/java/com/mooctest/crowd/site/service/impl/TechnicalArticlesServiceImpl.java

@@ -25,7 +25,7 @@ public class TechnicalArticlesServiceImpl implements TechnicalArticlesService{
     private TechnicalArticlesRepo technicalArticlesRepo;
 
     @Override
-    public TechnicalArticlesDTO getArticles(Pageable pageable, String keyword) {
+    public TechnicalArticlesDTO getArticles(Pageable pageable,String keyword) {
         TechnicalArticlesDTO  technicalArticlesDTO= new  TechnicalArticlesDTO();
         technicalArticlesDTO.setTechnicalArticlespage(technicalArticlesRepo.getTechnicalArticles(pageable, keyword).map(technicalArticles -> new TechnicalArticlesVO(technicalArticles)));
         return technicalArticlesDTO;