|
@@ -17,6 +17,7 @@ import com.redxun.knowledge.album.entity.enums.AlbumVersionEnum;
|
|
import com.redxun.knowledge.album.entity.vo.AlbumApproveFlowVo;
|
|
import com.redxun.knowledge.album.entity.vo.AlbumApproveFlowVo;
|
|
import com.redxun.knowledge.album.entity.vo.AlbumApproveListVo;
|
|
import com.redxun.knowledge.album.entity.vo.AlbumApproveListVo;
|
|
import com.redxun.knowledge.album.entity.vo.AlbumApproveVo;
|
|
import com.redxun.knowledge.album.entity.vo.AlbumApproveVo;
|
|
|
|
+import com.redxun.knowledge.album.entity.vo.AlbumYelpApproveListVo;
|
|
import com.redxun.knowledge.album.mapper.*;
|
|
import com.redxun.knowledge.album.mapper.*;
|
|
import com.redxun.knowledge.common.UserService;
|
|
import com.redxun.knowledge.common.UserService;
|
|
import com.redxun.knowledge.entity.dao.KnowledgeApprove;
|
|
import com.redxun.knowledge.entity.dao.KnowledgeApprove;
|
|
@@ -166,103 +167,124 @@ public class AlbumApproveServiceImpl extends SuperServiceImpl<AlbumApproveMapper
|
|
//根据专辑Id进行数据分组
|
|
//根据专辑Id进行数据分组
|
|
Map<String, List<AlbumApprove>> albumApproveMap = albumApproveList.stream().collect(Collectors.groupingBy(AlbumApprove::getAlbumId));
|
|
Map<String, List<AlbumApprove>> albumApproveMap = albumApproveList.stream().collect(Collectors.groupingBy(AlbumApprove::getAlbumId));
|
|
// 返回结果集
|
|
// 返回结果集
|
|
- List<AlbumApproveListVo> albumApproveListVos = new ArrayList<>();
|
|
|
|
|
|
+ List<AlbumApprove> albumApproveVos = new ArrayList<>();
|
|
// 遍历每组的数据
|
|
// 遍历每组的数据
|
|
Set<Map.Entry<String, List<AlbumApprove>>> entries = albumApproveMap.entrySet();
|
|
Set<Map.Entry<String, List<AlbumApprove>>> entries = albumApproveMap.entrySet();
|
|
for (Map.Entry<String, List<AlbumApprove>> entry : entries) {
|
|
for (Map.Entry<String, List<AlbumApprove>> entry : entries) {
|
|
List<AlbumApprove> value = entry.getValue();
|
|
List<AlbumApprove> value = entry.getValue();
|
|
for (int i = 0; i < value.size(); i++) {
|
|
for (int i = 0; i < value.size(); i++) {
|
|
- //给结果集赋值
|
|
|
|
- AlbumApproveListVo albumApproveListVo = new AlbumApproveListVo();
|
|
|
|
- albumApproveListVo.setPkId(value.get(i).getAlbumInfo().getPkId());
|
|
|
|
- albumApproveListVo.setAlbumName(value.get(i).getAlbumInfo().getName());
|
|
|
|
- String categoryId = value.get(i).getAlbumInfo().getCategoryId();
|
|
|
|
- AlbumCategory albumCategory = albumCategoryMapper.selectById(categoryId);
|
|
|
|
- if (albumCategory.getGrade() == 1) {
|
|
|
|
- albumApproveListVo.setCategoryName(albumCategory.getName());
|
|
|
|
- } else {
|
|
|
|
- AlbumCategory albumCategoryParent = albumCategoryMapper.
|
|
|
|
- selectOne(new LambdaQueryWrapper<AlbumCategory>().eq(AlbumCategory::getPkId, albumCategory.getParent()));
|
|
|
|
- albumApproveListVo.setCategoryName(albumCategoryParent.getName() + "|" + albumCategory.getName());
|
|
|
|
- }
|
|
|
|
- albumApproveListVo.setOwnerName(userService.queryOsUserDto(value.get(i).getAlbumInfo().getOwnerId()).getFullName());
|
|
|
|
- albumApproveListVo.setCreateTime(value.get(i).getAlbumVersion().getCreateTime());
|
|
|
|
- albumApproveListVo.setApprovalStateName(AlbumVersionApproveEnum.getMessage(value.get(i).getAlbumVersion().getApprovalState()));
|
|
|
|
- albumApproveListVo.setApproverId(value.get(i).getApproverId());
|
|
|
|
- albumApproveListVo.setVersionId(value.get(i).getAlbumVersion().getPkId());
|
|
|
|
- albumApproveListVo.setApprovalId(value.get(i).getPkId());
|
|
|
|
- albumApproveListVo.setApprovalState(value.get(i).getAlbumVersion().getApprovalState());
|
|
|
|
- Integer knowledgeTotal = albumInfoMapper.selectCountKnowledge(value.get(i).getAlbumInfo().getPkId(), value.get(i).getAlbumVersion().getPkId());
|
|
|
|
- albumApproveListVo.setKnowledgeTotal(knowledgeTotal);
|
|
|
|
- //动作标记
|
|
|
|
- String userId = userService.queryLoginUser();
|
|
|
|
- String deptId = userService.queryLoginUserDeptId();
|
|
|
|
- Integer count = albumApprovalNodeMapper.selectAllByDeptId(deptId, albumApproveListVo.getApproverId());
|
|
|
|
- List<String> actionFlag = new ArrayList<>();
|
|
|
|
- if ((userId.equals(albumApproveListVo.getApproverId()) || count > 0) &&
|
|
|
|
- (value.get(i).getAlbumVersion().getApprovalState() == 1 || value.get(i).getAlbumVersion().getApprovalState() == 2)) {
|
|
|
|
- actionFlag.add("approve");
|
|
|
|
- } else {
|
|
|
|
- actionFlag.add("view");
|
|
|
|
- }
|
|
|
|
- albumApproveListVo.setActionFlag(actionFlag);
|
|
|
|
// 如果是最终审核通过,直接放入记录
|
|
// 如果是最终审核通过,直接放入记录
|
|
if (value.get(i).getAlbumVersion().getApprovalState() == 5 && value.get(i).getIsFinal() == 1) {
|
|
if (value.get(i).getAlbumVersion().getApprovalState() == 5 && value.get(i).getIsFinal() == 1) {
|
|
- albumApproveListVo.setApprovalId(value.get(i).getPkId());
|
|
|
|
- //实际审核人姓名和实际审核人审核时间
|
|
|
|
- albumApproveListVo.setPreviousApproverName(value.get(i).getActualApproverName());
|
|
|
|
- albumApproveListVo.setPreviousApproverTime(value.get(i).getApprovalTime());
|
|
|
|
- albumApproveListVos.add(albumApproveListVo);
|
|
|
|
|
|
+ albumApproveVos.add(value.get(i));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
// 判断审批结果是否为null(如果审批结果没有null,证明审批已结束;如果等于0,证明审批没通过)
|
|
// 判断审批结果是否为null(如果审批结果没有null,证明审批已结束;如果等于0,证明审批没通过)
|
|
if (value.get(i).getResult() == null || value.get(i).getResult() == 0) {
|
|
if (value.get(i).getResult() == null || value.get(i).getResult() == 0) {
|
|
- if (i != 0) {
|
|
|
|
- // 如果不是第一条数据,取前一条数据的实际审核人姓名
|
|
|
|
- String actualApproverName = value.get(i - 1).getActualApproverName();
|
|
|
|
- albumApproveListVo.setPreviousApproverName(actualApproverName);
|
|
|
|
- // 如果不是第一条数据,取前一条数据的审批时间
|
|
|
|
- Date approvalTime = value.get(i - 1).getApprovalTime();
|
|
|
|
- albumApproveListVo.setPreviousApproverTime(approvalTime);
|
|
|
|
- } else {
|
|
|
|
- String actualApproverName = value.get(i).getActualApproverName();
|
|
|
|
- albumApproveListVo.setPreviousApproverName(actualApproverName);
|
|
|
|
- Date approvalTime = value.get(i).getApprovalTime();
|
|
|
|
- albumApproveListVo.setPreviousApproverTime(approvalTime);
|
|
|
|
- }
|
|
|
|
// 把该记录加到结果集中
|
|
// 把该记录加到结果集中
|
|
- albumApproveListVos.add(albumApproveListVo);
|
|
|
|
|
|
+ albumApproveVos.add(value.get(i));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ("1".equals(type)){
|
|
if ("1".equals(type)){
|
|
- List<AlbumApproveListVo> result = albumApproveListVos.stream().
|
|
|
|
|
|
+ List<AlbumApprove> result = albumApproveVos.stream().
|
|
sorted((t1, t2) -> t2.getCreateTime().compareTo(t1.getCreateTime())).collect(Collectors.toList());
|
|
sorted((t1, t2) -> t2.getCreateTime().compareTo(t1.getCreateTime())).collect(Collectors.toList());
|
|
Page pageResult = PageListUtils.getPages(queryFilter.getPage().getCurrent(), queryFilter.getPage().getSize(), result);
|
|
Page pageResult = PageListUtils.getPages(queryFilter.getPage().getCurrent(), queryFilter.getPage().getSize(), result);
|
|
|
|
+ List<AlbumApprove> records = pageResult.getRecords();
|
|
|
|
+ List<AlbumApproveListVo> collect = records.stream().map(this::pageInfo).collect(Collectors.toList());
|
|
|
|
+ pageResult.setRecords(collect);
|
|
return pageResult;
|
|
return pageResult;
|
|
} else {
|
|
} else {
|
|
//获取当前登录人的userId和deptId
|
|
//获取当前登录人的userId和deptId
|
|
String userId = userService.queryLoginUser();
|
|
String userId = userService.queryLoginUser();
|
|
String deptId = userService.queryLoginUserDeptId();
|
|
String deptId = userService.queryLoginUserDeptId();
|
|
|
|
|
|
- List<AlbumApproveListVo> albumApproveListVo1 = new ArrayList<>();
|
|
|
|
|
|
+ List<AlbumApprove> albumApproveListVo1 = new ArrayList<>();
|
|
//根据部门Id获取子部门信息
|
|
//根据部门Id获取子部门信息
|
|
//过滤数据
|
|
//过滤数据
|
|
- albumApproveListVos.forEach(albumApproveListVo -> {
|
|
|
|
|
|
+ albumApproveVos.forEach(albumApproveListVo -> {
|
|
Integer count = albumApprovalNodeMapper.selectAllByDeptId(deptId, albumApproveListVo.getApproverId());
|
|
Integer count = albumApprovalNodeMapper.selectAllByDeptId(deptId, albumApproveListVo.getApproverId());
|
|
if ((userId.equals(albumApproveListVo.getApproverId()) || count > 0) &&
|
|
if ((userId.equals(albumApproveListVo.getApproverId()) || count > 0) &&
|
|
- (albumApproveListVo.getApprovalState() == 1 || albumApproveListVo.getApprovalState() == 2)) {
|
|
|
|
|
|
+ (albumApproveListVo.getAlbumVersion().getApprovalState() == 1 || albumApproveListVo.getAlbumVersion().getApprovalState() == 2)) {
|
|
albumApproveListVo1.add(albumApproveListVo);
|
|
albumApproveListVo1.add(albumApproveListVo);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- List<AlbumApproveListVo> result = albumApproveListVo1.stream().
|
|
|
|
|
|
+ List<AlbumApprove> result = albumApproveListVo1.stream().
|
|
sorted((t1, t2) -> t2.getCreateTime().compareTo(t1.getCreateTime())).collect(Collectors.toList());
|
|
sorted((t1, t2) -> t2.getCreateTime().compareTo(t1.getCreateTime())).collect(Collectors.toList());
|
|
Page pageResult = PageListUtils.getPages(queryFilter.getPage().getCurrent(), queryFilter.getPage().getSize(),result);
|
|
Page pageResult = PageListUtils.getPages(queryFilter.getPage().getCurrent(), queryFilter.getPage().getSize(),result);
|
|
|
|
+ List<AlbumApprove> records = pageResult.getRecords();
|
|
|
|
+ List<AlbumApproveListVo> collect = records.stream().map(this::pageInfo).collect(Collectors.toList());
|
|
|
|
+ pageResult.setRecords(collect);
|
|
return pageResult;
|
|
return pageResult;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 返回值赋值
|
|
|
|
+ * @param albumApprove
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private AlbumApproveListVo pageInfo(AlbumApprove albumApprove){
|
|
|
|
+ AlbumApproveListVo albumApproveListVo = new AlbumApproveListVo();
|
|
|
|
+ albumApproveListVo.setPkId(albumApprove.getAlbumInfo().getPkId());
|
|
|
|
+ albumApproveListVo.setAlbumName(albumApprove.getAlbumInfo().getName());
|
|
|
|
+ String categoryId = albumApprove.getAlbumInfo().getCategoryId();
|
|
|
|
+ AlbumCategory albumCategory = albumCategoryMapper.selectById(categoryId);
|
|
|
|
+ if (albumCategory.getGrade() == 1) {
|
|
|
|
+ albumApproveListVo.setCategoryName(albumCategory.getName());
|
|
|
|
+ } else {
|
|
|
|
+ AlbumCategory albumCategoryParent = albumCategoryMapper.
|
|
|
|
+ selectOne(new LambdaQueryWrapper<AlbumCategory>().eq(AlbumCategory::getPkId, albumCategory.getParent()));
|
|
|
|
+ albumApproveListVo.setCategoryName(albumCategoryParent.getName() + "|" + albumCategory.getName());
|
|
|
|
+ }
|
|
|
|
+ albumApproveListVo.setOwnerName(userService.queryOsUserDto(albumApprove.getAlbumInfo().getOwnerId()).getFullName());
|
|
|
|
+ albumApproveListVo.setCreateTime(albumApprove.getAlbumVersion().getCreateTime());
|
|
|
|
+ albumApproveListVo.setApprovalStateName(AlbumVersionApproveEnum.getMessage(albumApprove.getAlbumVersion().getApprovalState()));
|
|
|
|
+ albumApproveListVo.setApproverId(albumApprove.getApproverId());
|
|
|
|
+ albumApproveListVo.setVersionId(albumApprove.getAlbumVersion().getPkId());
|
|
|
|
+ albumApproveListVo.setApprovalId(albumApprove.getPkId());
|
|
|
|
+ albumApproveListVo.setApprovalState(albumApprove.getAlbumVersion().getApprovalState());
|
|
|
|
+ Integer knowledgeTotal = albumInfoMapper.selectCountKnowledge(albumApprove.getAlbumInfo().getPkId(), albumApprove.getAlbumVersion().getPkId());
|
|
|
|
+ albumApproveListVo.setKnowledgeTotal(knowledgeTotal);
|
|
|
|
+ //动作标记
|
|
|
|
+ String userId = userService.queryLoginUser();
|
|
|
|
+ String deptId = userService.queryLoginUserDeptId();
|
|
|
|
+ Integer count = albumApprovalNodeMapper.selectAllByDeptId(deptId, albumApproveListVo.getApproverId());
|
|
|
|
+ List<String> actionFlag = new ArrayList<>();
|
|
|
|
+ if ((userId.equals(albumApproveListVo.getApproverId()) || count > 0) &&
|
|
|
|
+ (albumApprove.getAlbumVersion().getApprovalState() == 1 || albumApprove.getAlbumVersion().getApprovalState() == 2)) {
|
|
|
|
+ actionFlag.add("approve");
|
|
|
|
+ } else {
|
|
|
|
+ actionFlag.add("view");
|
|
|
|
+ }
|
|
|
|
+ albumApproveListVo.setActionFlag(actionFlag);
|
|
|
|
+ // 如果是最终审核通过(赋值实际审核人和审核时间)
|
|
|
|
+ if (albumApprove.getAlbumVersion().getApprovalState() == 5 || albumApprove.getAlbumVersion().getApprovalState() == 4
|
|
|
|
+ || albumApprove.getAlbumVersion().getApprovalState() == 3) {
|
|
|
|
+ String actualApproverName = albumApprove.getActualApproverName();
|
|
|
|
+ albumApproveListVo.setPreviousApproverName(actualApproverName);
|
|
|
|
+ Date approvalTime = albumApprove.getApprovalTime();
|
|
|
|
+ albumApproveListVo.setPreviousApproverTime(approvalTime);
|
|
|
|
+ } else {
|
|
|
|
+ //取前一条记录实际审核人和审核时间
|
|
|
|
+ QueryWrapper<AlbumApprove> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("VERSION_ID",albumApprove.getVersionId());
|
|
|
|
+ queryWrapper.eq("ALBUM_ID",albumApprove.getAlbumId());
|
|
|
|
+ queryWrapper.eq("SORT",albumApprove.getSort() - 1);
|
|
|
|
+ queryWrapper.orderByAsc("SORT");
|
|
|
|
+ AlbumApprove albumApproveBySort = albumApproveMapper.selectOne(queryWrapper);
|
|
|
|
+ if (albumApproveBySort != null){
|
|
|
|
+ String actualApproverName = albumApproveBySort.getActualApproverName();
|
|
|
|
+ albumApproveListVo.setPreviousApproverName(actualApproverName);
|
|
|
|
+ Date approvalTime = albumApproveBySort.getApprovalTime();
|
|
|
|
+ albumApproveListVo.setPreviousApproverTime(approvalTime);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return albumApproveListVo;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取当前登陆人待审核的专辑数量
|
|
* 获取当前登陆人待审核的专辑数量
|
|
*
|
|
*
|