Merge branch 'USVT-120' into 'master'
USVT-120 本地测试的时候出现时间偏移量的问题,这是因为服务器是部署在 UTC 时间上的,所以这个 Bug 没有发现。 See merge request usvisatrack/usvisatrack.api.service!3
This commit is contained in:
commit
2229afb503
|
@ -121,5 +121,16 @@ public class VisaController {
|
||||||
return myFavouredVisaCaseService.queryFavouredVisaCases(userDetail.getId());
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,12 +26,14 @@ public class VisaSubmitRequest {
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date dateVisaInterview;
|
private LocalDate dateVisaInterview;
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date dateVisaCheckCompleted;
|
private LocalDate dateVisaCheckCompleted;
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date dateVisaIssued;
|
private LocalDate dateVisaIssued;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ public interface VisaCaseRepository extends PagingAndSortingRepository<VisaCase,
|
||||||
" WHERE my_favoured_visa_case.user_id = :userId", nativeQuery = true)
|
" WHERE my_favoured_visa_case.user_id = :userId", nativeQuery = true)
|
||||||
List<VisaCase> queryFavouredVisaCaseByUserId(@Param("userId") Long userId);
|
List<VisaCase> queryFavouredVisaCaseByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
List<VisaCase> findVisaCaseBySaveUserIdEquals(Long userId);
|
||||||
|
|
||||||
@Query("select visaCase from VisaCase visaCase where visaCase.refCrawlCaseNumber = :caseNum")
|
@Query("select visaCase from VisaCase visaCase where visaCase.refCrawlCaseNumber = :caseNum")
|
||||||
Optional<VisaCase> findByRefCaseNum(@Param("caseNum") String caseNum);
|
Optional<VisaCase> findByRefCaseNum(@Param("caseNum") String caseNum);
|
||||||
|
|
|
@ -72,8 +72,12 @@ public class MyFavouredVisaCaseService {
|
||||||
*/
|
*/
|
||||||
public List<VisaCase> queryFavouredVisaCases(Long userId) {
|
public List<VisaCase> queryFavouredVisaCases(Long userId) {
|
||||||
log.info("Query user: {} favoured visa cases", userId);
|
log.info("Query user: {} favoured visa cases", userId);
|
||||||
|
|
||||||
return visaCaseRepository.queryFavouredVisaCaseByUserId(userId);
|
return visaCaseRepository.queryFavouredVisaCaseByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<VisaCase> getVisaCasesByUserId(Long userId) {
|
||||||
|
log.info("Search user visa cases by userId - [{}]", userId);
|
||||||
|
return visaCaseRepository.findVisaCaseBySaveUserIdEquals(userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -363,9 +363,9 @@ public class VisaCaseService {
|
||||||
visaCase.setVisaCategory(request.getVisaCategory());
|
visaCase.setVisaCategory(request.getVisaCategory());
|
||||||
visaCase.setVisaEntry(VisaEntry.valueOf(request.getVisaEntry()));
|
visaCase.setVisaEntry(VisaEntry.valueOf(request.getVisaEntry()));
|
||||||
visaCase.setVisaStatus(VisaStatus.valueOf(request.getVisaStatus()));
|
visaCase.setVisaStatus(VisaStatus.valueOf(request.getVisaStatus()));
|
||||||
visaCase.setDateVisaIssued(dateToLocalDate(request.getDateVisaIssued()));
|
visaCase.setDateVisaIssued(request.getDateVisaIssued());
|
||||||
visaCase.setDateVisaInterview(dateToLocalDate(request.getDateVisaInterview()));
|
visaCase.setDateVisaInterview(request.getDateVisaInterview());
|
||||||
visaCase.setDateVisaCheckCompleted(dateToLocalDate(request.getDateVisaCheckCompleted()));
|
visaCase.setDateVisaCheckCompleted(request.getDateVisaCheckCompleted());
|
||||||
visaCase.setEmbassyConsulate(request.getEmbassyConsulate());
|
visaCase.setEmbassyConsulate(request.getEmbassyConsulate());
|
||||||
visaCase.setSaveUserId(dbUser.getId());
|
visaCase.setSaveUserId(dbUser.getId());
|
||||||
visaCase.setUserEmail(dbUser.getUserEmail());
|
visaCase.setUserEmail(dbUser.getUserEmail());
|
||||||
|
@ -391,9 +391,9 @@ public class VisaCaseService {
|
||||||
visaCase.setVisaCategory(request.getVisaCategory());
|
visaCase.setVisaCategory(request.getVisaCategory());
|
||||||
visaCase.setVisaEntry(VisaEntry.valueOf(request.getVisaEntry()));
|
visaCase.setVisaEntry(VisaEntry.valueOf(request.getVisaEntry()));
|
||||||
visaCase.setVisaStatus(VisaStatus.valueOf(request.getVisaStatus()));
|
visaCase.setVisaStatus(VisaStatus.valueOf(request.getVisaStatus()));
|
||||||
visaCase.setDateVisaIssued(dateToLocalDate(request.getDateVisaIssued()));
|
visaCase.setDateVisaIssued(request.getDateVisaIssued());
|
||||||
visaCase.setDateVisaInterview(dateToLocalDate(request.getDateVisaInterview()));
|
visaCase.setDateVisaInterview(request.getDateVisaInterview());
|
||||||
visaCase.setDateVisaCheckCompleted(dateToLocalDate(request.getDateVisaCheckCompleted()));
|
visaCase.setDateVisaCheckCompleted(request.getDateVisaCheckCompleted());
|
||||||
visaCase.setEmbassyConsulate(request.getEmbassyConsulate());
|
visaCase.setEmbassyConsulate(request.getEmbassyConsulate());
|
||||||
|
|
||||||
return visaCaseRepository.save(visaCase);
|
return visaCaseRepository.save(visaCase);
|
||||||
|
|
Loading…
Reference in New Issue