Merge branch 'USVT-120' into 'master'

USVT-120 本地测试的时候出现时间偏移量的问题,这是因为服务器是部署在 UTC 时间上的,所以这个 Bug 没有发现。

See merge request usvisatrack/usvisatrack.api.service!3
This commit is contained in:
YuCheng Hu 2022-12-02 17:38:37 +00:00
commit 2229afb503
5 changed files with 29 additions and 10 deletions

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

@ -85,6 +85,7 @@ public interface VisaCaseRepository extends PagingAndSortingRepository<VisaCase,
" 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

@ -72,8 +72,12 @@ public class MyFavouredVisaCaseService {
*/
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

@ -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);