|
@@ -39,6 +39,8 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
@Component("WebMediator")
|
|
|
public class WebMediatorImpl implements ViewMediator {
|
|
|
+ @Autowired
|
|
|
+ private TestTypeDao testTypeDao;
|
|
|
|
|
|
@Autowired
|
|
|
private CrowdTestProjectRepo projectRepo;
|
|
@@ -49,6 +51,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Autowired
|
|
|
private EvaluationAgencyRepo evaluationAgencyRepo;
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
|
private CommonRepo commonRepo;
|
|
|
@Autowired
|
|
@@ -88,44 +91,44 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private QualificationDao qualificationDao;
|
|
|
|
|
|
@Autowired
|
|
|
- private BankCardDao bankCardDao;
|
|
|
+ private BankCardDao bankCardDao;
|
|
|
|
|
|
@Autowired
|
|
|
- private BankLogoDao bankLogoDao;
|
|
|
+ private BankLogoDao bankLogoDao;
|
|
|
|
|
|
@Value("${agency}")
|
|
|
private String agencyId;
|
|
|
|
|
|
@Override
|
|
|
public EnterpriseAuthVO getEnterpriseAuthByUserId(Long userId) {
|
|
|
- EnterpriseAuthentication enterpriseAuthentication=new EnterpriseAuthentication();
|
|
|
- EnterpriseAuthenticationPO enterpriseAuthenticationPO=enterpriseAuthenticationDao.findByUserId(userId);
|
|
|
- if(enterpriseAuthenticationPO==null){
|
|
|
- throw new BaseException("当前用户没有企业认证信息");
|
|
|
+ EnterpriseAuthentication enterpriseAuthentication = new EnterpriseAuthentication();
|
|
|
+ EnterpriseAuthenticationPO enterpriseAuthenticationPO = enterpriseAuthenticationDao.findByUserId(userId);
|
|
|
+ if (enterpriseAuthenticationPO == null) {
|
|
|
+ throw new BaseException("当前用户没有企业认证信息");
|
|
|
}
|
|
|
enterpriseAuthentication.getByPo(enterpriseAuthenticationPO);
|
|
|
- EnterpriseAuthVO enterpriseAuthVO=new EnterpriseAuthVO(enterpriseAuthentication);
|
|
|
- return enterpriseAuthVO;
|
|
|
+ EnterpriseAuthVO enterpriseAuthVO = new EnterpriseAuthVO(enterpriseAuthentication);
|
|
|
+ return enterpriseAuthVO;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public PersonalAuthVO getByUserId(Long userId) {
|
|
|
- PersonalAuthentication personalAuthentication=new PersonalAuthentication();
|
|
|
- PersonalAuthenticationPO personalAuthenticationPO=personalAuthenticationDao.findByUserId(userId);
|
|
|
- if(personalAuthenticationPO==null){
|
|
|
- throw new BaseException("当前用户没有认证信息");
|
|
|
+ PersonalAuthentication personalAuthentication = new PersonalAuthentication();
|
|
|
+ PersonalAuthenticationPO personalAuthenticationPO = personalAuthenticationDao.findByUserId(userId);
|
|
|
+ if (personalAuthenticationPO == null) {
|
|
|
+ throw new BaseException("当前用户没有认证信息");
|
|
|
}
|
|
|
personalAuthentication.getByPo(personalAuthenticationDao.findByUserId(userId));
|
|
|
- PersonalAuthVO personalAuthVO=new PersonalAuthVO(personalAuthentication);
|
|
|
- return personalAuthVO;
|
|
|
+ PersonalAuthVO personalAuthVO = new PersonalAuthVO(personalAuthentication);
|
|
|
+ return personalAuthVO;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public UserDTO loginByMobileAndPwd(LoginCommand cmd) {
|
|
|
- return null;
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -147,10 +150,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
List<ApplicationTypeVO> applicationTypeRanks = new ArrayList<>();
|
|
|
if (applicationTypeRanks.size() > top) {
|
|
|
- for(int i = 0; i < top; i++){
|
|
|
+ for (int i = 0; i < top; i++) {
|
|
|
applicationTypeRanks.add(applicationTypeRank.get(i));
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
applicationTypeRanks = applicationTypeRank;
|
|
|
}
|
|
|
|
|
@@ -171,10 +174,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
List<EvolutionAgencyVO> agencyRanks = new ArrayList<>();
|
|
|
if (agencyRank.size() > top) {
|
|
|
- for(int i = 0; i < top; i++){
|
|
|
+ for (int i = 0; i < top; i++) {
|
|
|
agencyRanks.add(agencyRank.get(i));
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
agencyRanks = agencyRank;
|
|
|
}
|
|
|
|
|
@@ -191,10 +194,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
List<UserVO> userRanks = new ArrayList<>();
|
|
|
if (userRank.size() > top) {
|
|
|
- for(int i = 0; i < top; i++){
|
|
|
+ for (int i = 0; i < top; i++) {
|
|
|
userRanks.add(userRank.get(i));
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
userRanks = userRank;
|
|
|
}
|
|
|
|
|
@@ -202,10 +205,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
List<Competition> competitionList = commonRepo.getAllCompetition();
|
|
|
List<Competition> competitionLists = new ArrayList<>();
|
|
|
if (competitionList.size() > top) {
|
|
|
- for(int i = 0; i < top; i++){
|
|
|
+ for (int i = 0; i < top; i++) {
|
|
|
competitionLists.add(competitionList.get(i));
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
competitionLists = competitionList;
|
|
|
}
|
|
|
|
|
@@ -718,7 +721,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public List<CrowdTestProjectVO> findByNameLike(String name) {
|
|
|
List<CrowdTestProjectVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(projectDao.findByNameLike("%"+name+"%").stream().map(crowdTestProjectPO -> {
|
|
|
+ authingList.addAll(projectDao.findByNameLike("%" + name + "%").stream().map(crowdTestProjectPO -> {
|
|
|
CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
|
return new CrowdTestProjectVO(crowdTestProject);
|
|
@@ -729,7 +732,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> findTaskByNameLike(String name) {
|
|
|
List<CrowdTaskVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(taskDao.findByNameLike("%"+name+"%").stream().map(crowdTestTaskPO -> {
|
|
|
+ authingList.addAll(taskDao.findByNameLike("%" + name + "%").stream().map(crowdTestTaskPO -> {
|
|
|
CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, crowdTestTask);
|
|
|
return new CrowdTaskVO(crowdTestTask);
|
|
@@ -744,6 +747,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
|
return new CrowdTestProjectVO(crowdTestProject);
|
|
|
+
|
|
|
}).collect(Collectors.toList()));
|
|
|
return authingList;
|
|
|
}
|
|
@@ -751,11 +755,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> crowdTaskVos() {
|
|
|
|
|
|
-
|
|
|
List<CrowdTaskVO> authingList = new ArrayList<>();
|
|
|
authingList.addAll(taskDao.findAll().stream().map(crowdTestTaskPO -> {
|
|
|
+ //根据code值查询出来该任务的type
|
|
|
+ Optional<TestTypePO> serviceType = testTypeDao.findByCode(crowdTestTaskPO.getType());
|
|
|
CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, crowdTestTask);
|
|
|
+ crowdTestTask.setType(serviceType.get().getName());
|
|
|
return new CrowdTaskVO(crowdTestTask);
|
|
|
}).collect(Collectors.toList()));
|
|
|
return authingList;
|
|
@@ -763,7 +769,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public UserDTO getInformation(long userId) {
|
|
|
- UserDTO userDTO=new UserDTO();
|
|
|
+ UserDTO userDTO = new UserDTO();
|
|
|
Optional<UserPO> userPO = userDao.findById(userId);
|
|
|
if (userPO.isPresent()) {
|
|
|
UserVO userVO = new UserVO();
|
|
@@ -787,23 +793,23 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@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());
|
|
|
+ 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());
|
|
|
return this.getInformation(userId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public QualificationDTO getQualification(long userId) {
|
|
|
- QualificationDTO qualificationDTO=new QualificationDTO();
|
|
|
+ QualificationDTO qualificationDTO = new QualificationDTO();
|
|
|
List<QualificationVO> qualificationVOList = new ArrayList<>();
|
|
|
- qualificationDao.findByUserIdAndIsDeleted(userId,DeletedStatus.isNotDeleted).forEach(qualificationPO ->{
|
|
|
+ qualificationDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted).forEach(qualificationPO -> {
|
|
|
QualificationVO qualificationVO = new QualificationVO();
|
|
|
qualificationVO.setId(qualificationPO.getId());
|
|
|
qualificationVO.setName(qualificationPO.getName());
|
|
@@ -819,8 +825,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public QualificationDTO addQualification(long userId,QualificationVO qualificationVO) {
|
|
|
- QualificationPO qualificationPO=new QualificationPO();
|
|
|
+ public QualificationDTO addQualification(long userId, QualificationVO qualificationVO) {
|
|
|
+ QualificationPO qualificationPO = new QualificationPO();
|
|
|
qualificationPO.setName(qualificationVO.getName());
|
|
|
qualificationPO.setNumber(qualificationVO.getNumber());
|
|
|
qualificationPO.setLicensingAuthority(qualificationVO.getLicensingAuthority());
|
|
@@ -832,8 +838,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public QualificationDTO updateQualification(long id, long userId,QualificationVO qualificationVO) {
|
|
|
- Optional<QualificationPO> qualificationPO=qualificationDao.findById(id);
|
|
|
+ public QualificationDTO updateQualification(long id, long userId, QualificationVO qualificationVO) {
|
|
|
+ Optional<QualificationPO> qualificationPO = qualificationDao.findById(id);
|
|
|
qualificationPO.get().setName(qualificationVO.getName());
|
|
|
qualificationPO.get().setNumber(qualificationVO.getNumber());
|
|
|
qualificationPO.get().setLicensingAuthority(qualificationVO.getLicensingAuthority());
|
|
@@ -845,7 +851,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public QualificationDTO deleteQualification(long id, long userId) {
|
|
|
- Optional<QualificationPO> qualificationPO=qualificationDao.findById(id);
|
|
|
+ Optional<QualificationPO> qualificationPO = qualificationDao.findById(id);
|
|
|
qualificationPO.get().setIsDeleted(1);
|
|
|
qualificationDao.save(qualificationPO.get());
|
|
|
return this.getQualification(userId);
|
|
@@ -853,14 +859,14 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public BankCardDTO getBankCard(long userId) {
|
|
|
- BankCardDTO bankCardDTO=new BankCardDTO();
|
|
|
+ BankCardDTO bankCardDTO = new BankCardDTO();
|
|
|
List<BankCardVO> bankCardVOList = new ArrayList<>();
|
|
|
- bankCardDao.findByUserIdAndIsDeleted(userId,DeletedStatus.isNotDeleted).forEach(bankCardPO ->{
|
|
|
+ bankCardDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted).forEach(bankCardPO -> {
|
|
|
BankCardVO bankCardVO = new BankCardVO();
|
|
|
bankCardVO.setId(bankCardPO.getId());
|
|
|
bankCardVO.setUser(bankCardPO.getUser());
|
|
|
bankCardVO.setNumber(bankCardPO.getNumber());
|
|
|
- Optional<BankLogoPO> bankLogo=bankLogoDao.findByCode(bankCardPO.getCode());
|
|
|
+ Optional<BankLogoPO> bankLogo = bankLogoDao.findByCode(bankCardPO.getCode());
|
|
|
bankCardVO.setLogoUrl(bankLogo.get().getLogoUrl());
|
|
|
bankCardVO.setName(bankLogo.get().getName());
|
|
|
bankCardVOList.add(bankCardVO);
|
|
@@ -872,11 +878,11 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public BankCardDTO addBankCard(long userId, BankCardVO bankCardVO) throws JSONException {
|
|
|
- BankCardPO bankCardPO=new BankCardPO();
|
|
|
- String bankNo=bankCardVO.getNumber();
|
|
|
- String url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo="+bankNo+"&cardBinCheck=true";
|
|
|
+ BankCardPO bankCardPO = new BankCardPO();
|
|
|
+ String bankNo = bankCardVO.getNumber();
|
|
|
+ String url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo=" + bankNo + "&cardBinCheck=true";
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
- String result = restTemplate.getForObject(url,String.class);
|
|
|
+ String result = restTemplate.getForObject(url, String.class);
|
|
|
JSONObject json = new JSONObject(result);
|
|
|
String bank = String.valueOf(json.get("bank"));
|
|
|
bankCardPO.setUser(bankCardVO.getUser());
|
|
@@ -886,9 +892,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
bankCardDao.save(bankCardPO);
|
|
|
return this.getBankCard(userId);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public BankCardDTO deleteBankCard(long id, long userId) {
|
|
|
- Optional<BankCardPO> bankCardPO=bankCardDao.findById(id);
|
|
|
+ Optional<BankCardPO> bankCardPO = bankCardDao.findById(id);
|
|
|
bankCardPO.get().setIsDeleted(1);
|
|
|
bankCardDao.save(bankCardPO.get());
|
|
|
return this.getBankCard(userId);
|
|
@@ -897,7 +904,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public TechnicalArticlesDTO updateRanking(long id) {
|
|
|
int i = technicalarticlesDao.updateReading(id);
|
|
|
- TechnicalArticlesDTO technicalArticlesDTO=new TechnicalArticlesDTO();
|
|
|
+ TechnicalArticlesDTO technicalArticlesDTO = new TechnicalArticlesDTO();
|
|
|
technicalArticlesDTO.setCount(i);
|
|
|
return technicalArticlesDTO;
|
|
|
}
|