Browse Source

Complete-API

new-feature
Viet.LeQ2 1 year ago
parent
commit
0296550dde
2 changed files with 5 additions and 5 deletions
  1. +3
    -3
      src/main/java/vn/azteam/tpf/service/impl/TBCodeDetailsImpl.java
  2. +2
    -2
      src/main/java/vn/azteam/tpf/web/rest/TBCodeResource.java

+ 3
- 3
src/main/java/vn/azteam/tpf/service/impl/TBCodeDetailsImpl.java View File

Boolean isRequestedFromWeb) { Boolean isRequestedFromWeb) {
// Optional<TBCropDTO> tBCropDTO = tBCropService.findOne(id); // Optional<TBCropDTO> tBCropDTO = tBCropService.findOne(id);


// if (!userRoleUtil.currentUserHasPermissionByCropId(tBCropDTO.getId())) {
// throw new BadRequestAlertException("1018", ENTITY_NAME, "1018");
// }
if (!userRoleUtil.currentUserHasPermissionByCropId(tBCropDTO.getId())) {
throw new BadRequestAlertException("1018", ENTITY_NAME, "1018");
}
Optional<UserDTO> currentUser = userService.getCurrentUserDTO(); Optional<UserDTO> currentUser = userService.getCurrentUserDTO();
TBCodeDetailsAndActivityDTO tbCodeDetailsAndActivityDTO = new TBCodeDetailsAndActivityDTO(); TBCodeDetailsAndActivityDTO tbCodeDetailsAndActivityDTO = new TBCodeDetailsAndActivityDTO();
tbCodeDetailsAndActivityDTO.setTbCropDTO(tBCropDTO); tbCodeDetailsAndActivityDTO.setTbCropDTO(tBCropDTO);

+ 2
- 2
src/main/java/vn/azteam/tpf/web/rest/TBCodeResource.java View File



//Authorize get list crop by customer of current user //Authorize get list crop by customer of current user
List<TBCodeDTO> result = page.getContent().stream() List<TBCodeDTO> result = page.getContent().stream()
// .filter(item -> userRoleUtil.currentUserHasPermissionByCustomerId(item.getTbCrop().getId())
// && userRoleUtil.currentUserHasPermissionByCropId(item.getTbCrop().getId()))
.filter(item -> userRoleUtil.currentUserHasPermissionByCustomerId(item.getTbCrop().getId())
&& userRoleUtil.currentUserHasPermissionByCropId(item.getTbCrop().getId()))
.sorted(Comparator.comparing( .sorted(Comparator.comparing(
TBCodeDTO::getCreatedDate, TBCodeDTO::getCreatedDate,
Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) Comparator.nullsFirst(Comparator.naturalOrder())).reversed())

Loading…
Cancel
Save