|
...
|
...
|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
5
|
5
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
6
|
6
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
7
|
7
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
8
|
+import com.github.pagehelper.Page;
|
|
8
|
9
|
import com.github.pagehelper.PageInfo;
|
|
9
|
10
|
import com.lframework.starter.bpm.dto.FlowTaskDto;
|
|
10
|
11
|
import com.lframework.starter.bpm.entity.FlowInstanceWrapper;
|
|
...
|
...
|
@@ -109,6 +110,12 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM |
|
109
|
110
|
Assert.greaterThanZero(pageIndex);
|
|
110
|
111
|
Assert.greaterThanZero(pageSize);
|
|
111
|
112
|
|
|
|
113
|
+ // 是否需要审核:true=只查当前用户待审核(showExamine=true)的数据;false或空=按原逻辑查所有
|
|
|
114
|
+ boolean onlyExamine = Boolean.TRUE.equals(vo.getNeedExamine());
|
|
|
115
|
+ if (onlyExamine) {
|
|
|
116
|
+ return queryExaminePage(pageIndex, pageSize, vo);
|
|
|
117
|
+ }
|
|
|
118
|
+
|
|
112
|
119
|
PageHelperUtil.startPage(pageIndex, pageSize);
|
|
113
|
120
|
List<CustomerCredit> datas = this.query(vo);
|
|
114
|
121
|
if (CollectionUtils.isNotEmpty(datas)) {
|
|
...
|
...
|
@@ -143,6 +150,52 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM |
|
143
|
150
|
return PageResultUtil.convert(new PageInfo<>(datas));
|
|
144
|
151
|
}
|
|
145
|
152
|
|
|
|
153
|
+ /**
|
|
|
154
|
+ * 只查询当前用户待审核(showExamine=true)的数据
|
|
|
155
|
+ * 待审核标记依赖流程待办任务,无法在SQL层过滤,需全量查询后内存过滤 + 手动分页
|
|
|
156
|
+ */
|
|
|
157
|
+ private PageResult<CustomerCredit> queryExaminePage(Integer pageIndex, Integer pageSize, QueryCustomerCreditVo vo) {
|
|
|
158
|
+ // 当前人员的待办任务数据
|
|
|
159
|
+ List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
|
|
|
160
|
+ if (CollectionUtils.isEmpty(flowTaskList)) {
|
|
|
161
|
+ Page<CustomerCredit> emptyPage = new Page<>(pageIndex, pageSize);
|
|
|
162
|
+ emptyPage.setTotal(0);
|
|
|
163
|
+ return PageResultUtil.convert(new PageInfo<>(emptyPage));
|
|
|
164
|
+ }
|
|
|
165
|
+ List<String> todoBusinessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
|
|
|
166
|
+ Set<String> todoBusinessIdSet = new HashSet<>(todoBusinessIds);
|
|
|
167
|
+
|
|
|
168
|
+ // 套用 vo 上的其他筛选条件后,只保留待办对应的资信(即当前用户待审核的数据)
|
|
|
169
|
+ List<CustomerCredit> filtered = this.query(vo).stream()
|
|
|
170
|
+ .filter(c -> todoBusinessIdSet.contains(c.getId()))
|
|
|
171
|
+ .collect(Collectors.toList());
|
|
|
172
|
+
|
|
|
173
|
+ // 流程数据(审核详情标记)
|
|
|
174
|
+ List<FlowInstanceWrapper> allFlowList = flowInstanceWrapperService.getFlowByBusinessIdList(
|
|
|
175
|
+ filtered.stream().map(CustomerCredit::getId).collect(Collectors.toList()));
|
|
|
176
|
+ List<String> allFlowIds = CollectionUtils.isNotEmpty(allFlowList)
|
|
|
177
|
+ ? allFlowList.stream().map(FlowInstanceWrapper::getBusinessId).collect(Collectors.toList())
|
|
|
178
|
+ : Collections.emptyList();
|
|
|
179
|
+ for (CustomerCredit customerCredit : filtered) {
|
|
|
180
|
+ customerCredit.setShowExamineDetail(allFlowIds.contains(customerCredit.getId()));
|
|
|
181
|
+ customerCredit.setShowExamine(true);
|
|
|
182
|
+ }
|
|
|
183
|
+
|
|
|
184
|
+ long total = filtered.size();
|
|
|
185
|
+ int fromIndex = (pageIndex - 1) * pageSize;
|
|
|
186
|
+ List<CustomerCredit> pageDatas;
|
|
|
187
|
+ if (fromIndex >= total) {
|
|
|
188
|
+ pageDatas = new ArrayList<>();
|
|
|
189
|
+ } else {
|
|
|
190
|
+ int toIndex = (int) Math.min(fromIndex + pageSize, total);
|
|
|
191
|
+ pageDatas = filtered.subList(fromIndex, toIndex);
|
|
|
192
|
+ }
|
|
|
193
|
+ Page<CustomerCredit> page = new Page<>(pageIndex, pageSize);
|
|
|
194
|
+ page.setTotal(total);
|
|
|
195
|
+ page.addAll(pageDatas);
|
|
|
196
|
+ return PageResultUtil.convert(new PageInfo<>(page));
|
|
|
197
|
+ }
|
|
|
198
|
+
|
|
146
|
199
|
@Override
|
|
147
|
200
|
public List<CustomerCredit> query(QueryCustomerCreditVo vo) {
|
|
148
|
201
|
|
...
|
...
|
|