|
@@ -36,6 +36,7 @@ import org.springblade.system.user.entity.User;
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
+import org.springframework.jdbc.core.SingleColumnRowMapper;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -47,10 +48,7 @@ import java.io.InputStream;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
import java.net.URLConnection;
|
|
import java.net.URLConnection;
|
|
-import java.util.Comparator;
|
|
|
|
-import java.util.Iterator;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -275,9 +273,12 @@ public class UserViewProjectContractController {
|
|
//剔除没有合同段的项目
|
|
//剔除没有合同段的项目
|
|
projectInfoVOS.removeIf(next -> next.getContractInfoList().size() == 0);
|
|
projectInfoVOS.removeIf(next -> next.getContractInfoList().size() == 0);
|
|
//排序项目
|
|
//排序项目
|
|
- String pIds = projectInfoVOS.stream().map(projectInfoVO -> projectInfoVO.getId() + "").collect(Collectors.joining(","));
|
|
|
|
- List<Long> collectIds = jdbcTemplate.query("select project_id from m_user_project_collect where is_deleted = 0 and user_id = " + AuthUtil.getUserId() + " and project_id in ( " + pIds + ")",
|
|
|
|
- new BeanPropertyRowMapper<>(Long.class));
|
|
|
|
|
|
+ List<Long> collectIds = new ArrayList<>();
|
|
|
|
+ if (!projectInfoVOS.isEmpty()) {
|
|
|
|
+ String pIds = projectInfoVOS.stream().map(projectInfoVO -> projectInfoVO.getId() + "").collect(Collectors.joining(","));
|
|
|
|
+ collectIds = jdbcTemplate.query("select project_id from m_user_project_collect where is_deleted = 0 and user_id = " + AuthUtil.getUserId() + " and project_id in ( " + pIds + ")",
|
|
|
|
+ new SingleColumnRowMapper<>(Long.class));
|
|
|
|
+ }
|
|
Map<Long, Long> collect = collectIds.stream().collect(Collectors.toMap(v -> v, v -> v, (k1, k2) -> k1));
|
|
Map<Long, Long> collect = collectIds.stream().collect(Collectors.toMap(v -> v, v -> v, (k1, k2) -> k1));
|
|
// 按是否收藏进行排序,然后按照sort 进行排序
|
|
// 按是否收藏进行排序,然后按照sort 进行排序
|
|
projectInfoVOS.sort((o1, o2) -> {
|
|
projectInfoVOS.sort((o1, o2) -> {
|