|
@@ -3,6 +3,7 @@ package com.lframework.xingyun.sc.impl.order; |
|
@@ -3,6 +3,7 @@ package com.lframework.xingyun.sc.impl.order; |
|
3
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
3
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
4
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
4
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
5
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
5
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
6
|
+import com.github.pagehelper.Page;
|
|
6
|
import com.github.pagehelper.PageInfo;
|
7
|
import com.github.pagehelper.PageInfo;
|
|
7
|
import com.lframework.starter.bpm.dto.FlowTaskDto;
|
8
|
import com.lframework.starter.bpm.dto.FlowTaskDto;
|
|
8
|
import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
|
9
|
import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
|
|
@@ -87,6 +88,12 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
|
@@ -87,6 +88,12 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
|
87
|
Assert.greaterThanZero(pageIndex);
|
88
|
Assert.greaterThanZero(pageIndex);
|
|
88
|
Assert.greaterThanZero(pageSize);
|
89
|
Assert.greaterThanZero(pageSize);
|
|
89
|
|
90
|
|
|
|
|
91
|
+ // 是否需要审核:true=只查当前用户待审核(showExamine=true)的数据;false或空=按原逻辑查所有
|
|
|
|
92
|
+ boolean onlyExamine = Boolean.TRUE.equals(vo.getNeedExamine());
|
|
|
|
93
|
+ if (onlyExamine) {
|
|
|
|
94
|
+ return queryExaminePage(pageIndex, pageSize, vo);
|
|
|
|
95
|
+ }
|
|
|
|
96
|
+
|
|
90
|
PageHelperUtil.startPage(pageIndex, pageSize);
|
97
|
PageHelperUtil.startPage(pageIndex, pageSize);
|
|
91
|
List<PurchaseOrderInfo> datas = this.query(vo);
|
98
|
List<PurchaseOrderInfo> datas = this.query(vo);
|
|
92
|
if (CollectionUtils.isNotEmpty(datas)) {
|
99
|
if (CollectionUtils.isNotEmpty(datas)) {
|
|
@@ -108,6 +115,45 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
|
@@ -108,6 +115,45 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
|
108
|
return PageResultUtil.convert(new PageInfo<>(datas));
|
115
|
return PageResultUtil.convert(new PageInfo<>(datas));
|
|
109
|
}
|
116
|
}
|
|
110
|
|
117
|
|
|
|
|
118
|
+ /**
|
|
|
|
119
|
+ * 只查询当前用户待审核(showExamine=true)的数据
|
|
|
|
120
|
+ * 待审核标记依赖流程待办任务,无法在SQL层过滤,需查询后内存过滤 + 手动分页
|
|
|
|
121
|
+ */
|
|
|
|
122
|
+ private PageResult<PurchaseOrderInfo> queryExaminePage(Integer pageIndex, Integer pageSize, QueryPurchaseOrderInfoVo vo) {
|
|
|
|
123
|
+ // 当前人员的待办任务数据
|
|
|
|
124
|
+ List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
|
|
|
|
125
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(flowTaskList)) {
|
|
|
|
126
|
+ Page<PurchaseOrderInfo> emptyPage = new Page<>(pageIndex, pageSize);
|
|
|
|
127
|
+ emptyPage.setTotal(0);
|
|
|
|
128
|
+ return PageResultUtil.convert(new PageInfo<>(emptyPage));
|
|
|
|
129
|
+ }
|
|
|
|
130
|
+ Set<String> todoBusinessIdSet = flowTaskList.stream()
|
|
|
|
131
|
+ .map(FlowTaskDto::getBusinessId)
|
|
|
|
132
|
+ .collect(Collectors.toSet());
|
|
|
|
133
|
+
|
|
|
|
134
|
+ // 套用 vo 上的其他筛选条件后,只保留待办对应的订货单(即当前用户待审核的数据)
|
|
|
|
135
|
+ List<PurchaseOrderInfo> filtered = this.query(vo).stream()
|
|
|
|
136
|
+ .filter(order -> todoBusinessIdSet.contains(order.getId()))
|
|
|
|
137
|
+ .collect(Collectors.toList());
|
|
|
|
138
|
+ for (PurchaseOrderInfo purchaseOrderInfo : filtered) {
|
|
|
|
139
|
+ purchaseOrderInfo.setShowExamine(true);
|
|
|
|
140
|
+ }
|
|
|
|
141
|
+
|
|
|
|
142
|
+ long total = filtered.size();
|
|
|
|
143
|
+ int fromIndex = (pageIndex - 1) * pageSize;
|
|
|
|
144
|
+ List<PurchaseOrderInfo> pageDatas;
|
|
|
|
145
|
+ if (fromIndex >= total) {
|
|
|
|
146
|
+ pageDatas = new ArrayList<>();
|
|
|
|
147
|
+ } else {
|
|
|
|
148
|
+ int toIndex = (int) Math.min(fromIndex + pageSize, total);
|
|
|
|
149
|
+ pageDatas = filtered.subList(fromIndex, toIndex);
|
|
|
|
150
|
+ }
|
|
|
|
151
|
+ Page<PurchaseOrderInfo> page = new Page<>(pageIndex, pageSize);
|
|
|
|
152
|
+ page.setTotal(total);
|
|
|
|
153
|
+ page.addAll(pageDatas);
|
|
|
|
154
|
+ return PageResultUtil.convert(new PageInfo<>(page));
|
|
|
|
155
|
+ }
|
|
|
|
156
|
+
|
|
111
|
@Override
|
157
|
@Override
|
|
112
|
public PageResult<PurchaseOrderInfo> queryCanRevokeOrChangeList(Integer pageIndex, Integer pageSize, QueryPurchaseOrderInfoVo vo) {
|
158
|
public PageResult<PurchaseOrderInfo> queryCanRevokeOrChangeList(Integer pageIndex, Integer pageSize, QueryPurchaseOrderInfoVo vo) {
|
|
113
|
|
159
|
|