Quellcode durchsuchen

Merge branch 'dev' of http://git.mooctest.com/tuosi-crowd-test-service/tuosi-backend

linyk vor 2 Jahren
Ursprung
Commit
cd8901e5a5
27 geänderte Dateien mit 115 neuen und 47 gelöschten Zeilen
  1. 3 0
      core/src/main/java/com/mooctest/crowd/domain/dao/EvaluationAgencyDao.java
  2. 1 0
      core/src/main/java/com/mooctest/crowd/domain/domainobject/CrowdTestTask.java
  3. 4 1
      core/src/main/java/com/mooctest/crowd/domain/model/BankCardPO.java
  4. 3 0
      core/src/main/java/com/mooctest/crowd/domain/model/CrowdTestTaskPO.java
  5. 6 4
      core/src/main/java/com/mooctest/crowd/domain/repository/EvaluationAgencyRepo.java
  6. BIN
      core/target/classes/com/mooctest/crowd/domain/dao/EvaluationAgencyDao.class
  7. BIN
      core/target/classes/com/mooctest/crowd/domain/domainobject/CrowdTestTask.class
  8. BIN
      core/target/classes/com/mooctest/crowd/domain/model/BankCardPO.class
  9. BIN
      core/target/classes/com/mooctest/crowd/domain/model/CrowdTestTaskPO.class
  10. BIN
      core/target/classes/com/mooctest/crowd/domain/repository/EvaluationAgencyRepo$1.class
  11. BIN
      core/target/classes/com/mooctest/crowd/domain/repository/EvaluationAgencyRepo.class
  12. 3 0
      site/src/main/java/com/mooctest/crowd/site/command/CrowdTestTaskCommand.java
  13. 1 0
      site/src/main/java/com/mooctest/crowd/site/controller/CrowdProjectController.java
  14. 1 0
      site/src/main/java/com/mooctest/crowd/site/data/vo/BankCardVO.java
  15. 2 0
      site/src/main/java/com/mooctest/crowd/site/data/vo/CrowdTaskVO.java
  16. 31 7
      site/src/main/java/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.java
  17. 32 32
      site/src/main/java/com/mooctest/crowd/site/service/impl/CrowdProjectServiceImpl.java
  18. 26 1
      site/src/main/java/com/mooctest/crowd/site/service/impl/CrowdTaskServiceImpl.java
  19. 1 1
      site/src/main/resources/application.yml
  20. 1 1
      site/target/classes/application.yml
  21. BIN
      site/target/classes/com/mooctest/crowd/site/command/CrowdTestTaskCommand.class
  22. BIN
      site/target/classes/com/mooctest/crowd/site/controller/CrowdProjectController.class
  23. BIN
      site/target/classes/com/mooctest/crowd/site/data/vo/BankCardVO.class
  24. BIN
      site/target/classes/com/mooctest/crowd/site/data/vo/CrowdTaskVO.class
  25. BIN
      site/target/classes/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.class
  26. BIN
      site/target/classes/com/mooctest/crowd/site/service/impl/CrowdProjectServiceImpl.class
  27. BIN
      site/target/classes/com/mooctest/crowd/site/service/impl/CrowdTaskServiceImpl.class

+ 3 - 0
core/src/main/java/com/mooctest/crowd/domain/dao/EvaluationAgencyDao.java

@@ -27,6 +27,9 @@ public interface EvaluationAgencyDao extends PagingAndSortingRepository<Evaluati
     @Override
     Iterable<EvaluationAgencyPO> findAll();
 
+    List<EvaluationAgencyPO> findByIsDeleted(int deletedStatus);
+
+
     @Override
     void delete(EvaluationAgencyPO evaluationAgencyPO);
 

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

@@ -46,6 +46,7 @@ public class CrowdTestTask {
     private int participantHasCommittedCount;
     private List<TaskToUser> acceptedUserList = new ArrayList<>();
     private EndPoint endPoint;
+    private int goPlatform;
 //    private List<CrowdTestReport> crowdTestReportList = new ArrayList<>();
 
     @Override

+ 4 - 1
core/src/main/java/com/mooctest/crowd/domain/model/BankCardPO.java

@@ -19,7 +19,10 @@ public class BankCardPO {
     private String user;
 
     @Column(name="BC_NUMBER")
-    private  String number;
+    private String number;
+
+    @Column(name="BC_SUBNAME")
+    private String subName;
 
     @Column(name = "BC_BL_CODE")
     private  String code;

+ 3 - 0
core/src/main/java/com/mooctest/crowd/domain/model/CrowdTestTaskPO.java

@@ -82,6 +82,9 @@ CrowdTestTaskPO {
     @Column(name = "CTT_PARTICIPANT_HAS_COMMITTED_COUNT")
     private int participantHasCommittedCount;
 
+    @Column(name = "CTT_GO_PLATFORM")
+    private int goPlatform;
+
     @Override
     public String toString() {
         return "CrowdTestTaskPO{" +

+ 6 - 4
core/src/main/java/com/mooctest/crowd/domain/repository/EvaluationAgencyRepo.java

@@ -61,10 +61,12 @@ public class EvaluationAgencyRepo implements IEvaluationAgencyRepo {
 
     @Override
     public List<EvaluationAgency> findAll() {
-        List<EvaluationAgency> evaluationAgencyList = new ArrayList<>();
-        Iterable<EvaluationAgencyPO> agencyPOS = evaluationAgencyDao.findAll();
-        agencyPOS.forEach(agencyPO -> evaluationAgencyList.add(Converter.convert(EvaluationAgency.class, agencyPO)));
-        return evaluationAgencyList;
+//        List<EvaluationAgency> evaluationAgencyList = new ArrayList<>();
+//        Iterable<EvaluationAgencyPO> agencyPOS = evaluationAgencyDao.findAll();
+//        agencyPOS.forEach(agencyPO -> evaluationAgencyList.add(Converter.convert(EvaluationAgency.class, agencyPO)));
+//        return evaluationAgencyList;
+        return evaluationAgencyDao.findByIsDeleted(DeletedStatus.isNotDeleted)
+                .stream().map(agencyPO -> Converter.convert(EvaluationAgency.class, agencyPO)).collect(Collectors.toList());
     }
 
     @Override

BIN
core/target/classes/com/mooctest/crowd/domain/dao/EvaluationAgencyDao.class


BIN
core/target/classes/com/mooctest/crowd/domain/domainobject/CrowdTestTask.class


BIN
core/target/classes/com/mooctest/crowd/domain/model/BankCardPO.class


BIN
core/target/classes/com/mooctest/crowd/domain/model/CrowdTestTaskPO.class


BIN
core/target/classes/com/mooctest/crowd/domain/repository/EvaluationAgencyRepo$1.class


BIN
core/target/classes/com/mooctest/crowd/domain/repository/EvaluationAgencyRepo.class


+ 3 - 0
site/src/main/java/com/mooctest/crowd/site/command/CrowdTestTaskCommand.java

@@ -30,6 +30,8 @@ public class CrowdTestTaskCommand {
     @NotNull(message = "请指定任务发布类型")
     private Long resource;
 
+    private Integer goPlatform;
+
     private Map<String, String> location;
 
     private String requirementFile;
@@ -73,6 +75,7 @@ public class CrowdTestTaskCommand {
         crowdTestTask.setFixedPrice(fixedPrice);
         crowdTestTask.setRequirementFile(requirementFile);
         crowdTestTask.setParticipantCount(participantCount);
+        crowdTestTask.setGoPlatform(goPlatform);
 
         if(endPoint.getServerCode() != null && endPoint.getServerCode() != ""){
             String serverCode = endPoint.getServerCode();

+ 1 - 0
site/src/main/java/com/mooctest/crowd/site/controller/CrowdProjectController.java

@@ -3,6 +3,7 @@ package com.mooctest.crowd.site.controller;
 import com.mooctest.crowd.domain.domainobject.CrowdTestProject;
 import com.mooctest.crowd.domain.exception.BadRequestException;
 import com.mooctest.crowd.domain.exception.BaseException;
+import com.mooctest.crowd.domain.exception.UnauthorizedException;
 import com.mooctest.crowd.site.annotation.LoginRequired;
 import com.mooctest.crowd.site.command.CrowdTestProjectCommand;
 import com.mooctest.crowd.site.command.GenerateProjectCommand;

+ 1 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/BankCardVO.java

@@ -11,6 +11,7 @@ public class BankCardVO {
     private String name;
     private String user;
     private String number;
+    private String subName;
     private String code;
     private Long userId;
     private String logoUrl;

+ 2 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/CrowdTaskVO.java

@@ -50,6 +50,7 @@ public class CrowdTaskVO implements Serializable{
     private String time_interval;
     private EndPointVO endPointVO;
     private String writeReportUrl;
+    private int goPlatform;
 
     public CrowdTaskVO(CrowdTestTask task){
         id = task.getCode();
@@ -75,6 +76,7 @@ public class CrowdTaskVO implements Serializable{
         joinCount = task.getAcceptedCount();
         createTime = task.getCreateTime();
         participantHasCommittedCount = task.getParticipantHasCommittedCount();
+        goPlatform = task.getGoPlatform();
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         try {
             Date date = df.parse(df.format(task.getCreateTime()));

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

@@ -422,7 +422,7 @@ public class WebMediatorImpl implements ViewMediator {
         List<EvaluationAgencyVO> agencyRanks = userTaskCountDao.findByType(RoleType.AGENCY.getId())
                 .stream().sorted(Comparator.comparing(UserTaskCountPO::getCount).reversed()).limit(top).collect(Collectors.toList())
                 .stream().map(userTaskCountPO -> {
-                    EvaluationAgencyPO agency = agencyDao.findByUserId(userTaskCountPO.getUserId());
+                    EvaluationAgencyPO agency = agencyDao.findByUserIdAndIsDeleted(userTaskCountPO.getUserId(), DeletedStatus.isNotDeleted);
                     EvaluationAgencyVO agencyVO = new EvaluationAgencyVO();
                     agencyVO.setAgencyPhoto(agency.getAgencyPhoto());
                     agencyVO.setTaskCount(userTaskCountPO.getCount());
@@ -545,7 +545,7 @@ public class WebMediatorImpl implements ViewMediator {
         }).filter(Objects::nonNull).collect(Collectors.toList());
         //获取机构排名
         List<EvaluationAgencyVO> agencyRanks = taskToUserDao.findTotalPriceOfAgency(pageable).stream().map(rankInfo -> {
-            EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
+            EvaluationAgencyPO agency = agencyDao.findByUserIdAndIsDeleted(rankInfo.getEntityId(), DeletedStatus.isNotDeleted);
             if (agency != null) {
                 EvaluationAgencyVO agencyVO = new EvaluationAgencyVO();
                 agencyVO.setEvaluationAgencyName(agency.getEvaluationAgencyName());
@@ -822,7 +822,7 @@ public class WebMediatorImpl implements ViewMediator {
 
             CrowdTaskVO crowdTaskVO = new CrowdTaskVO(crowdTestTask);
             if (crowdTestTask.getDistributionType() == 0) {
-                EvaluationAgencyPO agencyPO = agencyDao.findByUserId(crowdTestTask.getEvaluationAgencyId());
+                EvaluationAgencyPO agencyPO = agencyDao.findByUserIdAndIsDeleted(crowdTestTask.getEvaluationAgencyId(), DeletedStatus.isNotDeleted);
                 crowdTaskVO.setInstitution(agencyPO == null ? "该机构已注销" : agencyPO.getEvaluationAgencyName());
             }
             // 测试类型的转换
@@ -1068,11 +1068,33 @@ public class WebMediatorImpl implements ViewMediator {
 
     @Override
     public List<RegionalManagerVO> renderRegionManagerList() {
+//        List<RegionalManagerVO> regionalManagerVOList = new ArrayList<>();
+//        regionalManagerToRegionalDao.findAll().forEach(regionalManagerPO -> {
+//            RegionalManagerVO regionalManagerVO = new RegionalManagerVO();
+//            regionalManagerVO.setId(regionalManagerPO.getUserId());
+//            regionalManagerVO.setName(agencyDao.findByUserId(regionalManagerPO.getUserId()).getEvaluationAgencyName());
+//            regionalManagerVOList.add(regionalManagerVO);
+//        });
+//        List<RegionalManagerVO> results = regionalManagerVOList.stream().distinct().collect(Collectors.toList());
+
         List<RegionalManagerVO> regionalManagerVOList = new ArrayList<>();
-        regionalManagerToRegionalDao.findAll().forEach(regionalManagerPO -> {
+        List<UserToRolePO> userToRolePOS = userToRoleDao.findByRoleId(RoleType.REGIONAL_MANAGER.getId());
+        userToRolePOS.forEach(userToRolePO -> {
             RegionalManagerVO regionalManagerVO = new RegionalManagerVO();
-            regionalManagerVO.setId(regionalManagerPO.getUserId());
-            regionalManagerVO.setName(agencyDao.findByUserId(regionalManagerPO.getUserId()).getEvaluationAgencyName());
+            Long userId = userToRolePO.getUserId();
+            regionalManagerVO.setId(userId);
+            String name = null;
+            EvaluationAgencyPO evaluationAgencyPO = agencyDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted);
+            if (evaluationAgencyPO == null){
+                Optional<UserPO> userPOOptional = userDao.findById(userId);
+                if(userPOOptional.isPresent()){
+                    name = userPOOptional.get().getName();
+                }
+            }else{
+                name = evaluationAgencyPO.getEvaluationAgencyName();
+            }
+
+            regionalManagerVO.setName(name);
             regionalManagerVOList.add(regionalManagerVO);
         });
         List<RegionalManagerVO> results = regionalManagerVOList.stream().distinct().collect(Collectors.toList());
@@ -1082,7 +1104,7 @@ public class WebMediatorImpl implements ViewMediator {
     @Override
     public List<EvaluationAgencyVO> renderAgencyList() {
         List<EvaluationAgencyVO> agencyList = new ArrayList<>();
-        agencyDao.findAll().forEach(evaluationAgencyPO -> {
+        agencyDao.findByIsDeleted(DeletedStatus.isNotDeleted).forEach(evaluationAgencyPO -> {
             EvaluationAgencyVO agencyVO = new EvaluationAgencyVO();
             agencyVO.setId(evaluationAgencyPO.getUserId());
             agencyVO.setEvaluationAgencyName(evaluationAgencyPO.getEvaluationAgencyName());
@@ -1470,10 +1492,12 @@ public class WebMediatorImpl implements ViewMediator {
                 throw new HttpBadRequestException("银行卡已存在");
             }
         }
+
         bankCardPO.setUser(bankCardVO.getUser());
         bankCardPO.setNumber(bankCardVO.getNumber());
         bankCardPO.setCode(bank);
         bankCardPO.setUserId(userId);
+        bankCardPO.setSubName(bankCardVO.getSubName());
         bankCardDao.save(bankCardPO);
         return this.getBankCard(userId);
     }

+ 32 - 32
site/src/main/java/com/mooctest/crowd/site/service/impl/CrowdProjectServiceImpl.java

@@ -412,40 +412,40 @@ public class CrowdProjectServiceImpl implements CrowdProjectService {
     @Override
     public ProjectDetailsDTO confirmFinished(String projectCode, Long userId) {
         CrowdTestProject project = projectRepo.getByProjectCode(projectCode);
+        project.finishCrowdTestProject(userRepo.getByID(userId));
+        projectRepo.saveCrowdTestProject(project);
+        return getProjectDetails(projectCode, userId);
 
         // 更新项目下测评机构或者测试人员的接包次数
-        List<CrowdTestTask> crowdTestTasks = project.getCrowdTestTaskList();
-        for(CrowdTestTask crowdTestTask : crowdTestTasks) {
-            List<TaskToUser> acceptedUserList = crowdTestTask.getAcceptedUserList();
-            for (TaskToUser taskToUser : acceptedUserList) {
-                if(taskToUser.getHasReport() == 0){
-                    continue;
-                }
-                User user = userRepo.getByID(taskToUser.getUserId());
-
-                // 对用户判断认证类型 测评机构为2 测试人员为6
-                Optional<UserTaskCountPO> userTaskCountPOOptional = userTaskCountDao.findByUserId(user.getId());
-                if (!userTaskCountPOOptional.isPresent()) {
-                    if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.EVALUATION_USER.getName()))) {
-                        Long roleType = RoleType.EVALUATION_USER.getId();
-                        UserTaskCount userTaskCount = new UserTaskCount(user.getId(), 1L, roleType);
-                        userTaskCountDao.save(Converter.convert(UserTaskCountPO.class, userTaskCount));
-                    } else if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.AGENCY.getName()))) {
-                        Long roleType = RoleType.AGENCY.getId();
-                        UserTaskCount userTaskCount = new UserTaskCount(user.getId(), 1L, roleType);
-                        userTaskCountDao.save(Converter.convert(UserTaskCountPO.class, userTaskCount));
-                    }
-                } else {
-                    UserTaskCountPO userTaskCountPO = userTaskCountPOOptional.get();
-                    userTaskCountPO.setCount(userTaskCountPO.getCount() + 1);
-                    userTaskCountDao.save(userTaskCountPO);
-                }
-            }
-            project.finishCrowdTestProject(userRepo.getByID(userId));
-            projectRepo.saveCrowdTestProject(project);
-            return getProjectDetails(projectCode, userId);
-        }
-        return null;
+//        List<CrowdTestTask> crowdTestTasks = project.getCrowdTestTaskList();
+//        for(CrowdTestTask crowdTestTask : crowdTestTasks) {
+//            List<TaskToUser> acceptedUserList = crowdTestTask.getAcceptedUserList();
+//            for (TaskToUser taskToUser : acceptedUserList) {
+//                if(taskToUser.getHasReport() == 0){
+//                    continue;
+//                }
+//                User user = userRepo.getByID(taskToUser.getUserId());
+//
+//                // 对用户判断认证类型 测评机构为2 测试人员为6
+//                Optional<UserTaskCountPO> userTaskCountPOOptional = userTaskCountDao.findByUserId(user.getId());
+//                if (!userTaskCountPOOptional.isPresent()) {
+//                    if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.EVALUATION_USER.getName()))) {
+//                        Long roleType = RoleType.EVALUATION_USER.getId();
+//                        UserTaskCount userTaskCount = new UserTaskCount(user.getId(), 1L, roleType);
+//                        userTaskCountDao.save(Converter.convert(UserTaskCountPO.class, userTaskCount));
+//                    } else if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.AGENCY.getName()))) {
+//                        Long roleType = RoleType.AGENCY.getId();
+//                        UserTaskCount userTaskCount = new UserTaskCount(user.getId(), 1L, roleType);
+//                        userTaskCountDao.save(Converter.convert(UserTaskCountPO.class, userTaskCount));
+//                    }
+//                } else {
+//                    UserTaskCountPO userTaskCountPO = userTaskCountPOOptional.get();
+//                    userTaskCountPO.setCount(userTaskCountPO.getCount() + 1);
+//                    userTaskCountDao.save(userTaskCountPO);
+//                }
+//            }
+
+//        }
     }
 
     @Override

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

@@ -17,6 +17,7 @@ import com.mooctest.crowd.site.command.CrowdTestTaskCommand;
 import com.mooctest.crowd.site.data.dto.TaskDetailsDTO;
 import com.mooctest.crowd.site.data.dto.TaskSquareDTO;
 import com.mooctest.crowd.site.data.enums.ProjectType;
+import com.mooctest.crowd.site.data.enums.RoleType;
 import com.mooctest.crowd.site.data.tfidf.JabaResult;
 import com.mooctest.crowd.site.data.tfidf.TFIDFAnalyzer;
 import com.mooctest.crowd.site.data.vo.*;
@@ -56,6 +57,9 @@ public class CrowdTaskServiceImpl implements CrowdTaskService {
     CrowdTestTaskRepo crowdTestTaskRepo;
 
     @Autowired
+    private UserTaskCountDao userTaskCountDao;
+
+    @Autowired
     CrowdTestTaskDao taskDao;
 
     @Autowired
@@ -196,7 +200,28 @@ public class CrowdTaskServiceImpl implements CrowdTaskService {
             isFirstAcceptPeople = true;
         }
 
-        task.receive(userRepo.getByID(userId));
+        User user = userRepo.getByID(userId);
+        task.receive(user);
+
+        // 更新接包数量
+        // 对用户判断认证类型 测评机构为2 测试人员为6
+        Optional<UserTaskCountPO> userTaskCountPOOptional = userTaskCountDao.findByUserId(userId);
+        if (!userTaskCountPOOptional.isPresent()) {
+            if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.EVALUATION_USER.getName()))) {
+                Long roleType = RoleType.EVALUATION_USER.getId();
+                UserTaskCount userTaskCount = new UserTaskCount(user.getId(), 1L, roleType);
+                userTaskCountDao.save(Converter.convert(UserTaskCountPO.class, userTaskCount));
+            } else if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.AGENCY.getName()))) {
+                Long roleType = RoleType.AGENCY.getId();
+                UserTaskCount userTaskCount = new UserTaskCount(user.getId(), 1L, roleType);
+                userTaskCountDao.save(Converter.convert(UserTaskCountPO.class, userTaskCount));
+            }
+        } else {
+            UserTaskCountPO userTaskCountPO = userTaskCountPOOptional.get();
+            userTaskCountPO.setCount(userTaskCountPO.getCount() + 1);
+            userTaskCountDao.save(userTaskCountPO);
+        }
+
         project.setJoinCount(project.getJoinCount() + 1);
 
         // 判断是否为第三方任务,如果是则管理员自身也是一个参与者

+ 1 - 1
site/src/main/resources/application.yml

@@ -44,7 +44,7 @@ green:
 spring:
   profiles: dev
   datasource:
-    url: jdbc:mysql://8.134.32.27:3306/crowd-test-service-dev?useSSL=false&useUnicode=yes&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://8.134.32.27:3306/crowd-test-service-online?useSSL=false&useUnicode=yes&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
     username: root
     password: callfortest_crowd
   redis:

+ 1 - 1
site/target/classes/application.yml

@@ -47,7 +47,7 @@ green:
 spring:
   profiles: dev
   datasource:
-    url: jdbc:mysql://8.134.32.27:3306/crowd-test-service-dev?useSSL=false&useUnicode=yes&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://8.134.32.27:3306/crowd-test-service-online?useSSL=false&useUnicode=yes&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
     username: root
     password: callfortest_crowd
   redis:

BIN
site/target/classes/com/mooctest/crowd/site/command/CrowdTestTaskCommand.class


BIN
site/target/classes/com/mooctest/crowd/site/controller/CrowdProjectController.class


BIN
site/target/classes/com/mooctest/crowd/site/data/vo/BankCardVO.class


BIN
site/target/classes/com/mooctest/crowd/site/data/vo/CrowdTaskVO.class


BIN
site/target/classes/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.class


BIN
site/target/classes/com/mooctest/crowd/site/service/impl/CrowdProjectServiceImpl.class


BIN
site/target/classes/com/mooctest/crowd/site/service/impl/CrowdTaskServiceImpl.class