|
|
@@ -14,12 +14,14 @@ import com.izouma.jmrh.utils.excel.ExcelUtils;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.PageImpl;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/conversation")
|
|
|
@@ -40,9 +42,9 @@ public class ConversationController extends BaseController {
|
|
|
@PostMapping("/create")
|
|
|
public void create(@RequestParam Long sndId, @RequestParam String orgName,
|
|
|
@RequestParam String contactName, @RequestParam String contactPhone,
|
|
|
- @RequestParam(required = false) String email, @RequestParam String content) {
|
|
|
+ @RequestParam(required = false) String email, @RequestParam String content, @RequestParam String description) {
|
|
|
conversationService.create(SecurityUtils.getAuthenticatedUser().getId(),
|
|
|
- sndId, orgName, contactName, contactPhone, email, content);
|
|
|
+ sndId, orgName, contactName, contactPhone, email, content, description);
|
|
|
}
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@@ -53,7 +55,13 @@ public class ConversationController extends BaseController {
|
|
|
exists.add(Exist.PUBLISHERS_DELETED);
|
|
|
exists.add(Exist.ON_DELETED);
|
|
|
pageQuery.getQuery().put("exist", exists);
|
|
|
- return conversationRepo.findAll(toSpecification(pageQuery, Conversation.class), toPageRequest(pageQuery));
|
|
|
+ Page<Conversation> all = conversationRepo.findAll(toSpecification(pageQuery, Conversation.class), toPageRequest(pageQuery));
|
|
|
+ List<Conversation> content = all.getContent();
|
|
|
+ List<Conversation> filteredList = content.stream().filter(x -> x.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())).collect(Collectors.toList());
|
|
|
+ Page<Conversation> filteredPage = new PageImpl<>(filteredList, all.getPageable(), filteredList.size());
|
|
|
+
|
|
|
+ return filteredPage;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@GetMapping("/get/{id}")
|