|
@@ -53,6 +53,7 @@ import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -141,7 +142,7 @@ public class WmTaskTypeController {
|
|
|
* @return 分页数据
|
|
|
*/
|
|
|
@GetMapping("/page")
|
|
|
- public R<IPage<WmTaskTypeVO>> getWmTaskTypePage(Page<WmTaskType> page, WmTaskType wmTaskType) {
|
|
|
+ public R<?> getWmTaskTypePage(Page<WmTaskType> page, WmTaskType wmTaskType) {
|
|
|
|
|
|
List<String> noDisplayTaskTypeNameList =
|
|
|
Arrays.asList("专家咨询", "受试者管理",
|
|
@@ -152,7 +153,8 @@ public class WmTaskTypeController {
|
|
|
LambdaQueryWrapper<WmTaskType> queryWrapper = Wrappers.<WmTaskType>lambdaQuery();
|
|
|
|
|
|
// 二级代理(查询一级cso)
|
|
|
- if ("3".equals(wmTaskType.getStatus())) {
|
|
|
+ boolean secondary = "3".equals(wmTaskType.getStatus());
|
|
|
+ if (secondary) {
|
|
|
HnqzUser user = SecurityUtils.getUser();
|
|
|
// WmDaAgent one = wmDaAgentService.getOne(Wrappers.<WmDaAgent>lambdaQuery().eq(WmDaAgent::getDeptId, user.getDeptId()));
|
|
|
|
|
@@ -186,16 +188,32 @@ public class WmTaskTypeController {
|
|
|
.notIn(WmTaskType::getTaskTypeName, noDisplayTaskTypeNameList);
|
|
|
|
|
|
|
|
|
- Page<WmTaskType> pageResult = wmTaskTypeService.page(page, queryWrapper);
|
|
|
- Page<WmTaskTypeVO> voPage = new Page<>(pageResult.getCurrent(), pageResult.getSize(), pageResult.getTotal());
|
|
|
- List<WmTaskTypeVO> voList = pageResult.getRecords().stream().map(taskType -> {
|
|
|
+ wmTaskTypeService.page(page, queryWrapper);
|
|
|
+ List<WmTaskType> records = page.getRecords();
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(records)) {
|
|
|
+
|
|
|
+ return R.ok(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<WmTaskTypeVO> voList = page.getRecords().stream().map(taskType -> {
|
|
|
WmTaskTypeVO typeVO = BeanUtil.copyProperties(taskType, WmTaskTypeVO.class, "score", "taskScoreStart", "taskScoreEnd");
|
|
|
typeVO.setScore(String.valueOf(taskType.getScore()));
|
|
|
typeVO.setTaskScoreStart(String.valueOf(taskType.getTaskScoreStart()));
|
|
|
typeVO.setTaskScoreEnd(String.valueOf(taskType.getTaskScoreEnd()));
|
|
|
return typeVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
- voPage.setRecords(voList);
|
|
|
+
|
|
|
+ Page<WmTaskTypeVO> voPage = new Page<>(page.getCurrent(), page.getSize());
|
|
|
+
|
|
|
+ if (secondary){
|
|
|
+ List<WmTaskTypeVO> collect = voList.stream().filter(vo -> Objects.isNull(vo.getDurgentId())).collect(Collectors.toList());
|
|
|
+ voPage.setRecords(collect);
|
|
|
+ voPage.setTotal(collect.size());
|
|
|
+ } else {
|
|
|
+ voPage.setRecords(voList);
|
|
|
+ voPage.setTotal(page.getTotal());
|
|
|
+ }
|
|
|
|
|
|
return R.ok(voPage);
|
|
|
}
|