xuexiaobo 6 년 전
부모
커밋
856519a8b8

+ 1 - 0
core/src/main/java/com/mooctest/crowd/domain/domainobject/EvaluationAgency.java

@@ -97,6 +97,7 @@ public class EvaluationAgency {
         BeanUtils.copyProperties(modifyAuth,this);
         this.setIsAuthentication(AuthenticationStatus.isAuthenIng);
         this.setIsDeleted(DeletedStatus.isNotDeleted);
+        this.setIsAuthentication(AuthenticationStatus.isAuthenIng);
         this.setApplyTime(new Timestamp(System.currentTimeMillis()));
         this.setCheckTime(null);
         this.setExplain("");

+ 1 - 1
site/src/main/java/com/mooctest/crowd/site/command/AgencyUpdateCommand.java → site/src/main/java/com/mooctest/crowd/site/command/AgencyResourceAbilityUpdateCommand.java

@@ -11,7 +11,7 @@ import java.util.List;
  * @date 2019-08-12 01:05
  */
 @Data
-public class AgencyUpdateCommand {
+public class AgencyResourceAbilityUpdateCommand {
 //    @NotNull(message = "机构名称不可为空")
 //    private String evaluationAgencyName;
 //    @NotNull(message = "银行卡号不可为空")

+ 5 - 5
site/src/main/java/com/mooctest/crowd/site/controller/AgencyController.java

@@ -2,7 +2,7 @@ package com.mooctest.crowd.site.controller;
 
 import com.mooctest.crowd.domain.exception.BaseException;
 import com.mooctest.crowd.site.annotation.LoginRequired;
-import com.mooctest.crowd.site.command.AgencyUpdateCommand;
+import com.mooctest.crowd.site.command.AgencyResourceAbilityUpdateCommand;
 import com.mooctest.crowd.site.command.ApplyAgencyAuthCommand;
 import com.mooctest.crowd.site.command.GenerateAgencyCommand;
 import com.mooctest.crowd.site.data.dto.UserDTO;
@@ -73,7 +73,7 @@ public class AgencyController {
 
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/agency/status/accept", method = RequestMethod.PUT)
-    public UserDTO passAuth(@PathVariable("userId") Long userId, HttpSession session){
+    public AgencyVO passAuth(@PathVariable("userId") Long userId, HttpSession session){
         Long operatorId = Long.parseLong((String)session.getAttribute("userId"));
         return agencyService.passAuth(userId, operatorId);
     }
@@ -92,11 +92,11 @@ public class AgencyController {
      * @return
      */
     @LoginRequired
-    @RequestMapping(value = "/user/{userId}/updateAgency", method = RequestMethod.POST)
-    public UserDTO updateAgencyInfo(@PathVariable("userId") Long userId, @RequestBody @Validated AgencyUpdateCommand command, BindingResult result){
+    @RequestMapping(value = "/user/{userId}/agency/resource", method = RequestMethod.POST)
+    public AgencyVO updateAgencyResourceAndAbility(@PathVariable("userId") Long userId, @RequestBody @Validated AgencyResourceAbilityUpdateCommand command, BindingResult result){
         if (result.hasErrors())
             throw new BaseException(result.getFieldError().getDefaultMessage());
-        return agencyService.updateAgencyInfo(userId, command);
+        return agencyService.upadteResourceAndAbility(userId, command);
     }
 
     @LoginRequired

+ 2 - 2
site/src/main/java/com/mooctest/crowd/site/controller/TestController.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.mooctest.crowd.domain.dao.CrowdTestProjectDao;
 import com.mooctest.crowd.domain.dao.CrowdTestTaskDao;
 import com.mooctest.crowd.domain.dao.UserDao;
+import com.mooctest.crowd.domain.domainobject.CrowdTestProjectStatus;
 import com.mooctest.crowd.site.annotation.LoginRequired;
 import com.mooctest.crowd.site.anticorruption.impl.data.UserInfo;
 import com.mooctest.crowd.site.service.CrowdProjectService;
@@ -61,8 +62,7 @@ public class TestController {
 
     @RequestMapping(value = "/test", method = RequestMethod.POST)
     public Object exceptionTest() throws IOException {
-        Pageable pageable = PageRequest.of(0, 10);
-        return taskDao.findTotalPriceOfAgency(pageable);
+        return projectDao.findByStatusLessThanAndProjectDistributionTypeIdAndDistributionCity(CrowdTestProjectStatus.HAS_RECEIVED, 1L, "南京市");
     }
 
     @RequestMapping(value = "/session/put", method = RequestMethod.GET)

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

@@ -141,7 +141,7 @@ public class WebMediatorImpl implements ViewMediator {
             acceptableProject.addAll(projectDao.findAllByStatusLessThanAndProjectDistributionTypeId(CrowdTestProjectStatus.HAS_RECEIVED, 2L));
             //区域的
             for (Regional regional : user.getRegionalManager().getRegionalList()) {
-                acceptableProject.addAll(projectDao.findByStatusLessThanAndProjectDistributionTypeIdAndDistributionCity(CrowdTestProjectStatus.HAS_RECEIVED, 1L, regional.getId()+""));
+                acceptableProject.addAll(projectDao.findByStatusLessThanAndProjectDistributionTypeIdAndDistributionCity(CrowdTestProjectStatus.HAS_RECEIVED, 1L, regional.getName()));
             }
             myCrowdDTO.setAcceptableProjects(acceptableProject.stream().map(crowdTestProjectPO -> {
                 CrowdTestProject project = new CrowdTestProject();

+ 5 - 3
site/src/main/java/com/mooctest/crowd/site/service/AgencyService.java

@@ -1,6 +1,6 @@
 package com.mooctest.crowd.site.service;
 
-import com.mooctest.crowd.site.command.AgencyUpdateCommand;
+import com.mooctest.crowd.site.command.AgencyResourceAbilityUpdateCommand;
 import com.mooctest.crowd.site.command.ApplyAgencyAuthCommand;
 import com.mooctest.crowd.site.command.GenerateAgencyCommand;
 import com.mooctest.crowd.site.data.dto.UserDTO;
@@ -21,11 +21,13 @@ public interface AgencyService {
 
     UserDTO updateAgencyStatus(Long userId, Integer status);
 
-    UserDTO updateAgencyInfo(Long userId, AgencyUpdateCommand command);
+    AgencyVO updateAgencyInfo(Long userId, ApplyAgencyAuthCommand command);
+
+    AgencyVO upadteResourceAndAbility(Long userId, AgencyResourceAbilityUpdateCommand command);
 
     List<EvolutionAgencyVO> getAgencyList();
 
-    UserDTO passAuth(Long userId, Long operatorId);
+    AgencyVO passAuth(Long userId, Long operatorId);
 
     void rejectAuth(Long userId, Long operatorId);
 

+ 12 - 8
site/src/main/java/com/mooctest/crowd/site/service/impl/AgencyServiceImpl.java

@@ -8,10 +8,7 @@ import com.mooctest.crowd.domain.exception.UserNotExistException;
 import com.mooctest.crowd.domain.repository.EvaluationAgencyRepo;
 import com.mooctest.crowd.domain.repository.UserRepo;
 import com.mooctest.crowd.site.anticorruption.UserAntiCorruption;
-import com.mooctest.crowd.site.command.AgencyResourceCommand;
-import com.mooctest.crowd.site.command.AgencyUpdateCommand;
-import com.mooctest.crowd.site.command.ApplyAgencyAuthCommand;
-import com.mooctest.crowd.site.command.GenerateAgencyCommand;
+import com.mooctest.crowd.site.command.*;
 import com.mooctest.crowd.site.data.dto.UserDTO;
 import com.mooctest.crowd.site.data.vo.AgencyVO;
 import com.mooctest.crowd.site.data.vo.EvolutionAgencyVO;
@@ -94,7 +91,14 @@ public class AgencyServiceImpl implements AgencyService {
     }
 
     @Override
-    public UserDTO updateAgencyInfo(Long userId, AgencyUpdateCommand command) {
+    public AgencyVO updateAgencyInfo(Long userId, ApplyAgencyAuthCommand command) {
+        User user = userRepo.getByID(userId);
+        user.getEvaluationAgency().updateAuthInfo(command.toAgency());
+        return new AgencyVO(userRepo.saveUser(user).getEvaluationAgency());
+    }
+
+    @Override
+    public AgencyVO upadteResourceAndAbility(Long userId, AgencyResourceAbilityUpdateCommand command) {
         User user = userRepo.getByID(userId);
         EvaluationAgency agency = user.getEvaluationAgency();
         evaluationAgencyRepo.moveEvaluationAgencyAbility(agency.getEvaluationAgencyAbilityList());
@@ -102,7 +106,7 @@ public class AgencyServiceImpl implements AgencyService {
         agency.setEvaluationAgencyAbilityList(command.getEvaluationAgencyAbilityList().stream().map(EvaluationAgencyAbility::new).collect(Collectors.toList()));
         agency.setEvaluationAgencyResourceList(command.getEvaluationAgencyResourceList().stream().map(AgencyResourceCommand::toAgencyResource).collect(Collectors.toList()));
         user.setEvaluationAgency(agency);
-        return mediator.renderUser(userRepo.saveUser(user));
+        return new AgencyVO(userRepo.saveUser(user).getEvaluationAgency());
     }
 
     @Override
@@ -111,7 +115,7 @@ public class AgencyServiceImpl implements AgencyService {
     }
 
     @Override
-    public UserDTO passAuth(Long userId, Long operatorId) {
+    public AgencyVO passAuth(Long userId, Long operatorId) {
         User operator = userRepo.getByID(operatorId);
         if (operator.getRoleList().stream().noneMatch(role -> role.getName().equals("SystemAdministrator")))
             throw new UnauthorizedException("无权限进行此操作");
@@ -120,7 +124,7 @@ public class AgencyServiceImpl implements AgencyService {
             throw new BaseException("该用户未申请机构认证!");
         user.getEvaluationAgency().passAuthentication();
         user.getRoleList().add(userRepo.getRole("evaluationAgency"));
-        return mediator.renderUser(userRepo.saveUser(user));
+        return new AgencyVO(userRepo.saveUser(user).getEvaluationAgency());
     }
 
     @Override