|
@@ -22,6 +22,7 @@ import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
@@ -487,7 +488,11 @@ public class FixedFlowController extends BladeController {
|
|
|
@GetMapping("/getFixedFlowPage")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "分页", notes = "传入fixedFlow")
|
|
|
- public R<Page<Map<String, Object>>> getFixedFlowPage(PageFixedFlowDTO dto) {
|
|
|
+ public R<Page<FixedFlowVO>> getFixedFlowPage(PageFixedFlowDTO dto) {
|
|
|
+ if (dto.getCurrent() == null || dto.getSize() == null) {
|
|
|
+ return R.data(-1, null, "缺少size或current参数");
|
|
|
+ }
|
|
|
+
|
|
|
Page<FixedFlow> page = new Page<>(dto.getCurrent(), dto.getSize());
|
|
|
IPage<FixedFlow> fixedFlowsPage = fixedFlowService.getBaseMapper().selectPage(page,
|
|
|
Wrappers.<FixedFlow>lambdaQuery()
|
|
@@ -512,10 +517,13 @@ public class FixedFlowController extends BladeController {
|
|
|
.eq(Task::getContractId, dto.getContractId())
|
|
|
.isNotNull(Task::getFixedFlowId)
|
|
|
.groupBy(Task::getFixedFlowId)).stream().map(Task::getFixedFlowId).collect(Collectors.toList());
|
|
|
- List<Map<String, Object>> result = new LinkedList<>();
|
|
|
+ List<FixedFlowVO> fixedFlowVOList = new ArrayList<>();
|
|
|
for (FixedFlow fixedFlow : fixedFlows) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
List<FixedFlowLink> one = group.getOrDefault(fixedFlow.getId(), null);
|
|
|
+ FixedFlowVO vo = new FixedFlowVO();
|
|
|
+ BeanUtil.copyProperties(fixedFlow, vo);
|
|
|
+ fixedFlowVOList.add(vo);
|
|
|
+ vo.setFixedFlowLinkList( one);
|
|
|
if (one != null) {
|
|
|
/** 上面方法会去除同名流程*/
|
|
|
for (FixedFlowLink link : one) {
|
|
@@ -534,18 +542,33 @@ public class FixedFlowController extends BladeController {
|
|
|
l -> l.isEmpty() ? null : l.get(0)
|
|
|
)
|
|
|
)).values().stream().map(FixedFlowLink::getFixedFlowLink).collect(Collectors.toList());
|
|
|
- map.put("id", fixedFlow.getId());
|
|
|
- map.put("isUse", ids.contains(fixedFlow.getId()) ? 1 : 0);
|
|
|
- map.put("fixedFlowName", fixedFlow.getFixedFlowName());
|
|
|
- map.put("linkUserJoinString", StringUtils.join(names, ","));
|
|
|
- result.add(map);
|
|
|
+ vo.setDeletedIs(!ids.contains(fixedFlow.getId()));
|
|
|
+ vo.setLinkUserJoinString(StringUtils.join(names, ","));
|
|
|
}
|
|
|
}
|
|
|
- Page<Map<String, Object>> resultMap = new Page<>();
|
|
|
+ Page<FixedFlowVO> resultMap = new Page<>();
|
|
|
resultMap.setCurrent(fixedFlowsPage.getCurrent());
|
|
|
resultMap.setSize(fixedFlowsPage.getSize());
|
|
|
resultMap.setTotal(fixedFlowsPage.getTotal());
|
|
|
- resultMap.setRecords(result);
|
|
|
+ resultMap.setRecords(fixedFlowVOList);
|
|
|
+ fixedFlowVOList.sort(Comparator.comparing(FixedFlowVO::getSort));
|
|
|
+ Map<Boolean, List<FixedFlowVO>> groupMap = fixedFlowVOList.stream().collect(Collectors.groupingBy(record -> record.getFixedFlowName() != null && record.getFixedFlowName().contains("_") && record.getSort() == null));
|
|
|
+ List<FixedFlowVO> copyFixedFlowVOS = groupMap.get(true);
|
|
|
+ List<FixedFlowVO> fixedFlowVOS = groupMap.get(false);
|
|
|
+ if (copyFixedFlowVOS == null || copyFixedFlowVOS.isEmpty() || fixedFlowVOS == null || fixedFlowVOS.isEmpty()) {
|
|
|
+ return R.data(resultMap);
|
|
|
+ }
|
|
|
+ Map<String, List<FixedFlowVO>> nameMap = copyFixedFlowVOS.stream().collect(Collectors.groupingBy(record -> record.getFixedFlowName().split("_")[0]));
|
|
|
+ List<FixedFlowVO> newData = new ArrayList<>();
|
|
|
+ for (FixedFlowVO flowVO : fixedFlowVOS) {
|
|
|
+ newData.add(flowVO);
|
|
|
+ List<FixedFlowVO> flowVOS = nameMap.get(flowVO.getFixedFlowName());
|
|
|
+ if (flowVOS != null && !flowVOS.isEmpty()) {
|
|
|
+ flowVOS.sort(Comparator.comparing(FixedFlow::getFixedFlowName));
|
|
|
+ newData.addAll(flowVOS);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resultMap.setRecords(newData);
|
|
|
return R.data(resultMap);
|
|
|
}
|
|
|
return R.fail("暂无数据");
|