Merge remote-tracking branch 'origin/master'

This commit is contained in:
yang.xie 2022-12-03 16:38:18 +08:00
commit 90e208c99e
6 changed files with 99 additions and 17 deletions

53
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,53 @@
# This file is a template, and might need editing before it works on your project.
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
#
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
#
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job: # This job runs in the build stage, which runs first.
image: maven:3.8.6-ibm-semeru-11-focal
stage: build
script:
- echo "Compiling the code..."
- echo "Compile complete."
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
image: maven:3.8.6-ibm-semeru-11-focal
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
environment: production
script:
- echo "Deploying application..."
- echo "Application successfully deployed."

View File

@ -121,5 +121,16 @@ public class VisaController {
return myFavouredVisaCaseService.queryFavouredVisaCases(userDetail.getId());
}
@PreAuthorize("authentication.getPrincipal().toString()!=\"anonymousUser\"")
@GetMapping("/query-my-visa-case")
@Operation(summary = "获取我的关注签证列表", description = "获取我的关注签证列表")
public List<VisaCase> queryMyVisaCase() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
VisaTrackUserDetail userDetail = (VisaTrackUserDetail) authentication.getPrincipal();
return myFavouredVisaCaseService.getVisaCasesByUserId(userDetail.getId());
}
}

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.util.Date;
/**
@ -25,12 +26,14 @@ public class VisaSubmitRequest {
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dateVisaInterview;
private LocalDate dateVisaInterview;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dateVisaCheckCompleted;
private LocalDate dateVisaCheckCompleted;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dateVisaIssued;
private LocalDate dateVisaIssued;
}

View File

@ -12,9 +12,9 @@ import java.util.List;
import java.util.Optional;
/**
* Created with IntelliJ IDEA.
* VisaCase data Repository form database
*
* @Author: XieYang
* @author XieYang, YuCheng
* @Date: 2022/10/08/23:20
* @Description:
*/
@ -77,10 +77,15 @@ public interface VisaCaseRepository extends PagingAndSortingRepository<VisaCase,
@Param("endDate") LocalDate endDate);
@Query("select visaCase from VisaCase visaCase where visaCase.saveUserId in (select m.userId from " +
"MyFavouredVisaCase m where m.userId = :userId)")
// @Query("select visaCase from VisaCase visaCase where visaCase.saveUserId in (select m.userId from " +
// "MyFavouredVisaCase m where m.userId = :userId)")
@Query(value = " SELECT visa_case.* " +
" FROM visa_case " +
" JOIN my_favoured_visa_case ON visa_case.id = my_favoured_visa_case.visa_case_id " +
" WHERE my_favoured_visa_case.user_id = :userId", nativeQuery = true)
List<VisaCase> queryFavouredVisaCaseByUserId(@Param("userId") Long userId);
List<VisaCase> findVisaCaseBySaveUserIdEquals(Long userId);
@Query("select visaCase from VisaCase visaCase where visaCase.refCrawlCaseNumber = :caseNum")
Optional<VisaCase> findByRefCaseNum(@Param("caseNum") String caseNum);

View File

@ -12,9 +12,9 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* Created with IntelliJ IDEA.
* VisaCase Service
*
* @Author: XieYang
* @author XieYang, YuCheng
* @Date: 2022/10/23/17:40
* @Description:
*/
@ -66,10 +66,20 @@ public class MyFavouredVisaCaseService {
return myFavouredVisaCaseRepository.findAllByUserId(userId).stream().collect(Collectors.toList());
}
/**
* Get follow cases by userId
*
* @param userId
* @return
*/
public List<VisaCase> queryFavouredVisaCases(Long userId) {
log.info("Query user: {} favoured visa cases", userId);
return visaCaseRepository.queryFavouredVisaCaseByUserId(userId);
}
public List<VisaCase> getVisaCasesByUserId(Long userId) {
log.info("Search user visa cases by userId - [{}]", userId);
return visaCaseRepository.findVisaCaseBySaveUserIdEquals(userId);
}
}

View File

@ -52,7 +52,7 @@ import java.util.stream.Collectors;
/**
* Created with IntelliJ IDEA.
*
* @Author: XieYang
* @author XieYang, YuCheng
* @Date: 2022/10/14/16:17
* @Description:
*/
@ -363,9 +363,9 @@ public class VisaCaseService {
visaCase.setVisaCategory(request.getVisaCategory());
visaCase.setVisaEntry(VisaEntry.valueOf(request.getVisaEntry()));
visaCase.setVisaStatus(VisaStatus.valueOf(request.getVisaStatus()));
visaCase.setDateVisaIssued(dateToLocalDate(request.getDateVisaIssued()));
visaCase.setDateVisaInterview(dateToLocalDate(request.getDateVisaInterview()));
visaCase.setDateVisaCheckCompleted(dateToLocalDate(request.getDateVisaCheckCompleted()));
visaCase.setDateVisaIssued(request.getDateVisaIssued());
visaCase.setDateVisaInterview(request.getDateVisaInterview());
visaCase.setDateVisaCheckCompleted(request.getDateVisaCheckCompleted());
visaCase.setEmbassyConsulate(request.getEmbassyConsulate());
visaCase.setSaveUserId(dbUser.getId());
visaCase.setUserEmail(dbUser.getUserEmail());
@ -391,9 +391,9 @@ public class VisaCaseService {
visaCase.setVisaCategory(request.getVisaCategory());
visaCase.setVisaEntry(VisaEntry.valueOf(request.getVisaEntry()));
visaCase.setVisaStatus(VisaStatus.valueOf(request.getVisaStatus()));
visaCase.setDateVisaIssued(dateToLocalDate(request.getDateVisaIssued()));
visaCase.setDateVisaInterview(dateToLocalDate(request.getDateVisaInterview()));
visaCase.setDateVisaCheckCompleted(dateToLocalDate(request.getDateVisaCheckCompleted()));
visaCase.setDateVisaIssued(request.getDateVisaIssued());
visaCase.setDateVisaInterview(request.getDateVisaInterview());
visaCase.setDateVisaCheckCompleted(request.getDateVisaCheckCompleted());
visaCase.setEmbassyConsulate(request.getEmbassyConsulate());
return visaCaseRepository.save(visaCase);