|
|
|
@@ -82,8 +82,8 @@ public class TBCodeResource { |
|
|
|
|
|
|
|
//Authorize get list crop by customer of current user |
|
|
|
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( |
|
|
|
TBCodeDTO::getCreatedDate, |
|
|
|
Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) |
|
|
|
@@ -107,8 +107,8 @@ public class TBCodeResource { |
|
|
|
|
|
|
|
//Authorize get list crop by customer of current user |
|
|
|
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( |
|
|
|
TBCodeDTO::getCreatedDate, |
|
|
|
Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) |
|
|
|
@@ -208,7 +208,8 @@ public class TBCodeResource { |
|
|
|
@PostMapping("/tb-codes/create/activity") |
|
|
|
@Timed |
|
|
|
public ResponseEntity<TBActivityDTO> createActivityForTBCode(@RequestBody ActivityCodeCreationDTO |
|
|
|
activityCodeCreationDTO) throws IOException { |
|
|
|
activityCodeCreationDTO) |
|
|
|
throws URISyntaxException { |
|
|
|
|
|
|
|
log.debug("REST request to save TBActivityDTO : {}", activityCodeCreationDTO); |
|
|
|
//Set created by to current user login |
|
|
|
@@ -241,8 +242,8 @@ public class TBCodeResource { |
|
|
|
activityDTO.setCropId(activityCodeCreationDTO.getTbCropId()); |
|
|
|
activityDTO.setCreatedDate(Instant.now()); |
|
|
|
TBActivityDTO result = tBActivityService.save(activityDTO); |
|
|
|
return ResponseEntity.badRequest() |
|
|
|
.headers(HeaderUtil.createEntityUpdateAlert("TBActivity", "Created activity success!")) |
|
|
|
return ResponseEntity.created(new URI("/tb-codes/create/activity" + result.getId())) |
|
|
|
.headers(HeaderUtil.createEntityCreationAlert("TBActivity", result.getId().toString())) |
|
|
|
.body(result); |
|
|
|
} |
|
|
|
|