Browse Source

删除部分无用的接口和代码

郭超 4 years ago
parent
commit
f36891109d

+ 1 - 108
core/src/main/java/com/mooctest/crowd/domain/domainobject/User.java

@@ -43,41 +43,10 @@ public class User {
     private EnterpriseAuthentication enterpriseAuthentication;
     private SystemAdministratorToUser systemAdministratorToUser;
 
-
-    public User() {
-    }
-
-    @Override
-    public String toString() {
-        return "User{" +
-                "id=" + id +
-                ", name='" + name + '\'' +
-                ", userName='" + userName + '\'' +
-                ", password='" + password + '\'' +
-                ", gender='" + gender + '\'' +
-                ", mobile='" + mobile + '\'' +
-                ", email='" + email + '\'' +
-                ", province='" + province + '\'' +
-                ", city='" + city + '\'' +
-                ", photoUrl='" + photoUrl + '\'' +
-                ", isAvailable=" + isAvailable +
-                ", isDeleted=" + isDeleted +
-                ", createTime=" + createTime +
-                ", regionalManager=" + regionalManager +
-                ", evaluationAgency=" + evaluationAgency +
-                ", personalAuthentication=" + personalAuthentication +
-                ", systemAdministratorToUser=" + systemAdministratorToUser +
-                ", roleList=" + roleList +
-                '}';
-    }
-
-
-    public   User(UserPO userPO){
+    public User(UserPO userPO){
         BeanUtils.copyProperties(userPO,this);
     }
 
-
-
     /**
      * 机构认证——申请
      * @param evaluationAgency
@@ -215,82 +184,6 @@ public class User {
         return this;
     }
 
-    /**
-     * 企业认证——申请
-     * @return
-     */
-//    public User applyEnterpriseAuthentication(EnterpriseAuthentication enterpriseAuth) {
-//        if (this.getEvaluationAgency()!=null || this.getPersonalAuthentication()!=null || this.getEnterpriseAuthentication()!=null)
-//            throw new BaseException("已有认证信息,不可再次认证");
-//        this.setEnterpriseAuthentication(enterpriseAuth.applyAuthentication(this.id));
-//        return this;
-//    }
-
-    /**
-     * 企业认证——通过
-     * @return
-     */
-//    public User passEnterpriseAuthApplication(User enterpriseUser) {
-//        //判断是否为系统管理员
-//        judgeIsSystemAdministrator();
-//
-//        EnterpriseAuthentication enterpriseAuth = enterpriseUser.getEnterpriseAuthentication();
-//        if(enterpriseAuth.getIsAuthentication() == AuthenticationStatus.isNotAuthenticated){
-//            throw new BaseException("当前是未通过认证状态,不可通过认证,需对认证信息进行修改后再提交认证申请");
-//        }else if(enterpriseAuth.getIsAuthentication() == AuthenticationStatus.isAuthenticated){
-//            throw new BaseException("当前已通过认证,不可再次进行认证");
-//        }else{
-//            enterpriseAuth.passAuthentication();
-//            List<Role> roleList = this.getRoleList();
-//            Role role = new Role();
-//            role.setId(5L);
-//            roleList.add(role);
-//            enterpriseUser.setRoleList(roleList);
-//            return enterpriseUser;
-//        }
-//    }
-
-    /**
-     * 企业认证——驳回,并说明驳回原因
-     * @param explain
-     * @return
-     */
-//    public User enterpriseAuthReject(User enterpriseUser, String explain) {
-//        //判断是否为系统管理员
-//        judgeIsSystemAdministrator();
-//
-//        EnterpriseAuthentication enterpriseAuth = enterpriseUser.getEnterpriseAuthentication();
-//        enterpriseAuth.rejectAuthentication(explain);
-//        return enterpriseUser;
-//    }
-
-    /**
-     * 企业认证——修改
-     * @param modifyAuth
-     * @return
-     */
-//    public User updateEnterpriseAuthInfo(EnterpriseAuthentication modifyAuth){
-//        if (this.getEnterpriseAuthentication() == null){
-//            throw new BaseException("该用户未申请企业认证,无法修改");
-//        }
-//        if (this.getEvaluationAgency()!=null || this.getPersonalAuthentication()!=null)
-//            throw new BaseException("已有其他认证信息,不可对认证未企业用户");
-//        if (this.getEnterpriseAuthentication().getIsAuthentication() == AuthenticationStatus.isAuthenticated){
-//            throw new BaseException("已通过认证,不可修改认证信息");
-//        }
-//        this.getEnterpriseAuthentication().updateAuthInfo(modifyAuth);
-//        return this;
-//    }
-
-    /**
-     * 企业认证——删除
-     * @return
-     */
-//    public User deleteEnterpriseAuthInfo() {
-//        this.getEnterpriseAuthentication().deleteAuth();
-//        return this;
-//    }
-
     //判断是否为系统管理员
     private void judgeIsSystemAdministrator(){
         if(this.getSystemAdministratorToUser() == null){

+ 0 - 19
core/src/main/java/com/mooctest/crowd/domain/repository/IUserRepo.java

@@ -3,11 +3,8 @@ package com.mooctest.crowd.domain.repository;
 import com.mooctest.crowd.domain.domainobject.User;
 import com.mooctest.crowd.domain.domainobject.UserTaskCount;
 import com.mooctest.crowd.domain.exception.UserNotExistException;
-import com.mooctest.crowd.domain.model.UserPO;
 
 import javax.management.relation.RoleNotFoundException;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * @Author: xuexb
@@ -29,20 +26,8 @@ public interface IUserRepo {
 
     User getInfoAndEvaluationAgencyByID(Long userId) throws UserNotExistException;
 
-    List<User> getByIdList(List<Long> ids) throws RoleNotFoundException;
-
-    List<User> getAllUser() throws RoleNotFoundException;
-
-    ArrayList<UserPO> getAllUserInfo() throws RoleNotFoundException;
-
     UserTaskCount getUserTaskCountByUserId(Long userId);
 
-//    User getByEvaluationAgencyByUserId(Long userId) throws UserNotExistException, com.mooctest.crowd.domain.exception.RoleNotFoundException;
-
-    void removeUser(User user);
-
-    void removeUserList(List<User> userList);
-
     User saveUser(User user) throws RoleNotFoundException;
 
     User saveUserJustInfo(User user);
@@ -50,8 +35,4 @@ public interface IUserRepo {
     User saveEvaluationAgencyByUser(User user);
 
     User savePersonalAuthByUser(User user);
-
-    User saveUserAndRole(User user);
-
-    List<User> getApplyEvaluationAgencyByIsAuthenticated();
 }

+ 0 - 30
core/src/main/java/com/mooctest/crowd/domain/repository/UserRepo.java

@@ -24,8 +24,6 @@ import java.util.stream.Collectors;
 @Component
 public class UserRepo implements IUserRepo {
 	@Autowired
-	private EvaluationAgencyDao agencyDao;
-	@Autowired
 	private TestTypeDao testTypeDao;
 
 	@Autowired
@@ -59,15 +57,9 @@ public class UserRepo implements IUserRepo {
 	private AgencyAbilityDao agencyAbilityDao;
 
 	@Autowired
-	private EvaluationAgencyRepo resourceRepo;
-
-	@Autowired
 	private PersonalAuthenticationDao personalAuthenticationDao;
 
 	@Autowired
-	private EnterpriseAuthenticationDao enterpriseAuthenticationDao;
-
-	@Autowired
 	private SystemAdministratorToUserDao systemAdministratorToUserDao;
 
 	private Timestamp currentTime = new Timestamp(System.currentTimeMillis());
@@ -230,28 +222,6 @@ public class UserRepo implements IUserRepo {
 		}
 	}
 
-
-	//add
-//    @Override
-//    public User getByEvaluationAgencyByUserId(Long userId) throws UserNotExistException, RoleNotFoundException {
-//
-//        EvaluationAgencyPO evaluationAgencyPO = evaluationAgencyDao.findByUserId(userId);
-//        if(evaluationAgencyPO == null){
-//            throw new EvaluationAgencyNotExistException();
-//        }else{
-//            Optional<UserPO> userPOOptional = userDao.findById(userId);
-//            if (!userPOOptional.isPresent()) {
-//                throw new UserNotExistException();
-//            }else {
-//                UserPO userPO = userPOOptional.get();
-//                User user = getUserAndRoleAndPermissionByUserPO(userPO);
-//                user.setEvaluationAgency(evaluationAgencyResult);
-//                return user;
-//            }
-//        }
-//
-//    }
-
 	@Override
 	public void removeUser(User user) {
 		UserPO userPO = Converter.convert(UserPO.class, user);

+ 1 - 86
site/src/main/java/com/mooctest/crowd/site/controller/UserController.java

@@ -15,8 +15,6 @@ import com.mooctest.crowd.site.data.response.ServerCode;
 import com.mooctest.crowd.site.data.vo.BaseAuthVO;
 import com.mooctest.crowd.site.data.vo.PersonalAuthVO;
 import com.mooctest.crowd.site.data.vo.UserVO;
-import com.mooctest.crowd.site.service.EnterpriseAuthService;
-import com.mooctest.crowd.site.service.PersonalAuthService;
 import com.mooctest.crowd.site.service.UserService;
 import com.mooctest.crowd.site.util.DataUtils;
 import io.swagger.annotations.Api;
@@ -27,7 +25,6 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
-import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 
@@ -40,11 +37,6 @@ import java.util.List;
 @RestController
 @RequestMapping("/api")
 public class UserController extends BaseController{
-    @Autowired
-    private PersonalAuthService personalAuthService;
-    @Autowired
-    private EnterpriseAuthService enterpriseAuthService;
-
 
     @Autowired
     private UserService userService;
@@ -235,83 +227,6 @@ public class UserController extends BaseController{
         return userService.getPersonalAuthInfo(userId);
     }
 
-//    /**
-//     * 获取企业认证信息
-//     *
-//     * @param userId
-//     * @return
-//     */
-//    @LoginRequired
-//    @RequestMapping(value = "/user/{userId}/enterpriseAuth", method = RequestMethod.GET)
-//    public EnterpriseAuthVO getEnterpriseAuthInfo(@PathVariable("userId") Long userId) {
-//        return userService.getEnterpriseAuthInfo(userId);
-//    }
-//
-//    /**
-//     * 申请企业认证接口
-//     *
-//     * @param userId
-//     * @param command
-//     * @param result
-//     * @param session
-//     * @return
-//     */
-//    @LoginRequired
-//    @PostMapping(value = "/user/{userId}/enterpriseAuth")
-//    public EnterpriseAuthVO test(@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());
-//        System.out.println(command);
-//        return userService.applyEnterpriseAuth(userId, command);
-//    }
-//
-//    /**
-//     * 更新企业认证信息
-//     *
-//     * @param userId
-//     * @param command
-//     * @param result
-//     * @return
-//     */
-//    @LoginRequired
-//    @RequestMapping(value = "/user/{userId}/enterpriseAuth", method = RequestMethod.PUT)
-//    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);
-//    }
-//
-//    /**
-//     * 企业认证:审核通过
-//     *
-//     * @param userId
-//     * @return
-//     */
-//    @LoginRequired
-//    @SysAdminRequired
-//    @RequestMapping(value = "/user/{userId}/enterpriseAuth/status/accept", method = RequestMethod.PUT)
-//    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) {
-//        return userService.rejectEnterpriseAuth(userId, command.getExplain());
-//    }
-
     @LoginRequired
     @SysAdminRequired
     @RequestMapping(value = "/user/authentication/handling", method = RequestMethod.GET)
@@ -333,7 +248,7 @@ public class UserController extends BaseController{
      * @return
      */
     @RequestMapping(value = "index/address", method = RequestMethod.GET)
-    public Area getAddressByIp(HttpServletRequest request) throws UnsupportedEncodingException{
+    public Area getAddressByIp(HttpServletRequest request){
         String ip = DataUtils.getClientIp(request);
         LOG.info("ip地址是========" + ip);
         Area area = AddressUtils.getProvinceName(ip);

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

@@ -43,6 +43,5 @@ public class PersonalAuthVO {
         }
         this.authStatus = new StatusVO();
         this.authStatus.initAuthStatus(this.isAuthentication);
-
     }
 }

+ 0 - 3
site/src/main/java/com/mooctest/crowd/site/service/CommonService.java

@@ -14,7 +14,6 @@ import java.util.Map;
 @Service
 public interface CommonService {
 
-
     List<UserVO> getMoreUser(Pageable pageable,String keyword);
 
     IndexDTO getIndexInfo();
@@ -29,8 +28,6 @@ public interface CommonService {
 
     IndexPageDTO getIndexPageInfo(Pageable pageable, Map<String, String> extraCondition, String keyword, int deletedStatus);
 
-    Page<CrowdProjectVO> getProjectInfo(Pageable pageable, String keyword, int deletedStatus);
-
     List<ApplicationTypeVO> getHotTesting(String keyword);
 
     Page<CompetitionVO> getCompetition(Pageable pageable,String keyword);

+ 0 - 7
site/src/main/java/com/mooctest/crowd/site/service/CrowdProjectService.java

@@ -8,7 +8,6 @@ import com.mooctest.crowd.site.data.vo.CrowdProjectVO;
 import com.mooctest.crowd.site.data.vo.CrowdTestProjectVO;
 import com.mooctest.crowd.site.data.vo.RegionalManagerVO;
 import com.mooctest.crowd.site.data.vo.SearchConditionVO;
-import org.springframework.data.domain.Pageable;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
@@ -28,12 +27,6 @@ public interface CrowdProjectService {
 
     List<CrowdTestProjectVO> findByNameLike(String name);
 
-    List<CrowdTestProjectVO> findSquareProjectByNameLike(String name);
-
-    List<CrowdTestProjectVO> findAll(Pageable pageable);
-
-    List<CrowdTestProjectVO> findAll();
-
     ProjectDetailsDTO getProjectDetails(String projectCode, Long userId);
 
     ProjectDetailsDTO createCrowdProject(CrowdTestProjectCommand command,long userId);

+ 0 - 37
site/src/main/java/com/mooctest/crowd/site/service/impl/AgencyServiceImpl.java

@@ -70,46 +70,9 @@ public class AgencyServiceImpl implements AgencyService {
         if(taskCountByUserId != null){
             agencyVO.setTaskCount(taskCountByUserId.getCount());
         }
-
-//        List<String> agencyAbilities = new ArrayList<>();//机构能力list
-//        //根据compentence[]从test——type表利查询对应的能力名称
-//        EvaluationAgencyPO agencyPO = agencyDao.findByUserId(userId);
-//        if (agencyPO==null) {
-//            throw new HttpBadRequestException("机构不存在!");
-//        }
-//        EvaluationAgency evaluationAgency = new EvaluationAgency(agencyPO);
-//        Optional<UserPO> userPO = userDao.findById(userId);
-//        String userCompetence="";
-//        if(userPO.get().getPersonalCompetence()!=null) {
-//             userCompetence = userPO.get().getPersonalCompetence();
-//        }
-//        //将 userConpetence按逗号分搁
-//        List<String> compentenceList=new ArrayList<>();
-//        System.out.println(userCompetence+"sasssss");
-//        if (userCompetence!=null&&!userCompetence.trim().equals("")){
-//            compentenceList= Arrays.asList(userCompetence.split(",")); //JKCS,JRXCE,KKXCS,WDXCS
-//            for (int i = 0; i < compentenceList.size(); i++) {
-//                //查询对应code的测试类型的名称比如接口测试,兼用型测试等。
-//                Optional<TestTypePO> testTypePO = testTypeDao.findByCode(compentenceList.get(i));
-//                agencyAbilities.add(testTypePO.get().getName());
-//            }
-//        }
-//        EvaluationAgencyVO agencyVO = new EvaluationAgencyVO(evaluationAgency);
-//        agencyVO.setAuthStatus(evaluationAgency.getIsAuthentication());
-//        List<RankCountInfo> rankCountInfoList = taskToUserDao.findTotalCountOfUser();
-//        long ids[] = new long[rankCountInfoList.size()];
-//        for (int i = 0; i < ids.length; i++) {
-//            ids[i] = rankCountInfoList.get(i).getEntityId();
-//            if (ids[i] == agencyVO.getUserId()) {
-//                agencyVO.setTaskCount(rankCountInfoList.get(i).getCount());
-//            }
-//        }
-//        agencyVO.setAgencyAbilities(agencyAbilities);
         return agencyVO;
     }
 
-
-
     @Override
     public AgencyDetailVO getAgencyInfoCommon(Long userId){
         EvaluationAgency agency = evaluationAgencyRepo.findAgencyByUserId(userId);

+ 0 - 5
site/src/main/java/com/mooctest/crowd/site/service/impl/CommonServiceImpl.java

@@ -138,11 +138,6 @@ public class CommonServiceImpl implements CommonService {
     }
 
     @Override
-    public Page<CrowdProjectVO> getProjectInfo(Pageable pageable, String keyword, int deletedStatus) {
-        return projectRepo.findAllByPage(pageable, keyword, deletedStatus).map(crowdTestProject -> new CrowdProjectVO(crowdTestProject));
-    }
-
-    @Override
     public List<ApplicationTypeVO> getHotTesting(String keyword) {
 
         Pageable pageable = PageRequest.of(0, CommonConstant.HOT_CROWD_ROWS_ON_PAGE);

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

@@ -1,7 +1,10 @@
 package com.mooctest.crowd.site.service.impl;
 
 import com.google.common.collect.Lists;
-import com.mooctest.crowd.domain.dao.*;
+import com.mooctest.crowd.domain.dao.ApplicationTypeDao;
+import com.mooctest.crowd.domain.dao.FieldDao;
+import com.mooctest.crowd.domain.dao.TestTypeDao;
+import com.mooctest.crowd.domain.dao.UserTaskCountDao;
 import com.mooctest.crowd.domain.domainobject.*;
 import com.mooctest.crowd.domain.exception.BadRequestException;
 import com.mooctest.crowd.domain.exception.BaseException;
@@ -33,7 +36,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -56,11 +58,6 @@ import java.util.stream.Collectors;
 @Slf4j
 @Service
 public class CrowdProjectServiceImpl implements CrowdProjectService {
-    @Autowired
-    private CrowdTestProjectDao projectDao;
-
-    @Autowired
-    private UserToRoleDao userToRoleDao;
 
     @Autowired
     private ViewMediator viewMediator;
@@ -159,14 +156,6 @@ public class CrowdProjectServiceImpl implements CrowdProjectService {
     }
 
     @Override
-    public List<CrowdTestProjectVO> findSquareProjectByNameLike(String name) {
-        if (name == null || name.trim().equals("")) {
-            return viewMediator.AllByPage();
-        }
-        return viewMediator.findByNameLike(name);
-    }
-
-    @Override
     public List<CrowdTestProjectVO> findByNameLike(String name) {
         if (name == null || name.trim().equals("")) {
             return viewMediator.AllByPage();
@@ -175,25 +164,6 @@ public class CrowdProjectServiceImpl implements CrowdProjectService {
 
     }
 
-    /**
-     * 众测项目分页查询服务,过滤掉已完成的。
-     *
-     * @param pageable
-     * @return
-     */
-    @Override
-    public List<CrowdTestProjectVO> findAll(Pageable pageable) {
-
-        return viewMediator.crowdTestProjects();
-    }
-
-
-    @Override
-    public List<CrowdTestProjectVO> findAll() {
-        return viewMediator.crowdTestProjects();
-    }
-
-
     @Override
     public ProjectDetailsDTO getProjectDetails(String projectCode, Long userId) {
         CrowdTestProject project = projectRepo.getByProjectCode(projectCode);