release_1.0.0
liu 10 months ago
parent 5ec1b19314
commit 652bd5823c

@ -1,6 +1,8 @@
package com.supervision.knowsub.service.impl; package com.supervision.knowsub.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -16,6 +18,7 @@ import com.supervision.knowsub.model.*;
import com.supervision.knowsub.service.*; import com.supervision.knowsub.service.*;
import com.supervision.knowsub.util.UserUtil; import com.supervision.knowsub.util.UserUtil;
import com.supervision.knowsub.vo.knowledge.KnowledgeFlowResVO; import com.supervision.knowsub.vo.knowledge.KnowledgeFlowResVO;
import com.supervision.knowsub.vo.knowledge.KnowledgePageResVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
@ -57,17 +60,38 @@ public class KnowledgeFlowServiceImpl implements KnowledgeFlowService {
String submittedDeptId, Instant flowType, String submittedDeptId, Instant flowType,
LocalDateTime publishDateBegin, LocalDateTime publishDateEnd, LocalDateTime publishDateBegin, LocalDateTime publishDateEnd,
Integer pageNum, Integer pageSize) { Integer pageNum, Integer pageSize) {
Assert.notNull(processStatus, "审批状态不能为空");
UserInfo user = UserUtil.getUser();
IPage<KnowledgeFlowResVO> result;
// 查询待办 // 查询待办
if (1 == processStatus) { if (1 == processStatus) {
return knowledgeFlowRecordService.queryKnowledgeFlowTodoPage(title, publishDeptId, baseId, submittedDeptId, flowType, result = knowledgeFlowRecordService.queryKnowledgeFlowTodoPage(user.getId(), title, publishDeptId, baseId, submittedDeptId, flowType,
publishDateBegin, publishDateEnd, new Page<>(pageNum, pageSize)); publishDateBegin, publishDateEnd, new Page<>(pageNum, pageSize));
} }
// 查询已办 // 查询已办
if (2 == processStatus) { else if (2 == processStatus) {
return knowledgeFlowRecordService.queryKnowledgeFlowCompletePage(title, publishDeptId, baseId, submittedDeptId, flowType, result = knowledgeFlowRecordService.queryKnowledgeFlowCompletePage(user.getId(), title, publishDeptId, baseId, submittedDeptId, flowType,
publishDateBegin, publishDateEnd, new Page<>(pageNum, pageSize)); publishDateBegin, publishDateEnd, new Page<>(pageNum, pageSize));
} else {
throw new BusinessException("不支持的状态类型");
} }
throw new BusinessException("不支持的状态类型"); // 然后填充一些字段
List<KnowledgeFlowResVO> records = result.getRecords();
// 获取所有部门
Set<String> publishDeptSet = records.stream().map(KnowledgeFlowResVO::getPublishDeptId).collect(Collectors.toSet());
Set<String> submitDeptSet = records.stream().map(KnowledgeFlowResVO::getSubmitDeptId).collect(Collectors.toSet());
Collection<String> deptIdSet = CollUtil.union(submitDeptSet, publishDeptSet);
Map<String, String> deptMap = systemDeptService.listByIds(deptIdSet).stream().collect(Collectors.toMap(SystemDept::getId, SystemDept::getDeptName));
// 获取所有子库
Set<String> userIdSet = records.stream().map(KnowledgeFlowResVO::getSubmitUserId).collect(Collectors.toSet());
Map<String, String> userMap = systemUserService.listByIds(userIdSet).stream().collect(Collectors.toMap(SystemUser::getId, SystemUser::getUsername));
for (KnowledgeFlowResVO record : records) {
record.setSubmitUserName(userMap.getOrDefault(record.getSubmitUserId(), "未知用户"));
record.setSubmitDeptName(deptMap.getOrDefault(record.getSubmitDeptId(), "未知部门"));
record.setPublishDeptName(deptMap.getOrDefault(record.getPublishDeptId(), "未知部门"));
}
return result;
} }
/** /**
@ -131,6 +155,7 @@ public class KnowledgeFlowServiceImpl implements KnowledgeFlowService {
todo.setKnowledgeId(knowledge.getId()); todo.setKnowledgeId(knowledge.getId());
todo.setRuleId(nextRule.getId()); todo.setRuleId(nextRule.getId());
todo.setTodoUserId(todoUser.getUserId()); todo.setTodoUserId(todoUser.getUserId());
todo.setSubmitUserId(userId);
todo.insert(); todo.insert();
} }
} }
@ -234,6 +259,7 @@ public class KnowledgeFlowServiceImpl implements KnowledgeFlowService {
todo.setFlowId(nextRule.getFlowId()); todo.setFlowId(nextRule.getFlowId());
todo.setKnowledgeId(knowledgeFlowTodo.getKnowledgeId()); todo.setKnowledgeId(knowledgeFlowTodo.getKnowledgeId());
todo.setTodoUserId(todoUser.getUserId()); todo.setTodoUserId(todoUser.getUserId());
todo.setSubmitUserId(submitFlowRecord.getSubmitUserId());
todo.setFlowType(knowledgeFlowTodo.getFlowType()); todo.setFlowType(knowledgeFlowTodo.getFlowType());
todo.setRuleId(nextRule.getId()); todo.setRuleId(nextRule.getId());
todo.insert(); todo.insert();

@ -19,6 +19,7 @@ import java.time.LocalDateTime;
public interface KnowledgeFlowRecordMapper extends BaseMapper<KnowledgeFlowRecord> { public interface KnowledgeFlowRecordMapper extends BaseMapper<KnowledgeFlowRecord> {
IPage<KnowledgeFlowResVO> queryKnowledgeFlowTodoPage( IPage<KnowledgeFlowResVO> queryKnowledgeFlowTodoPage(
@Param("userId") String userId,
@Param("title") String title, @Param("title") String title,
@Param("publishDeptId") String publishDeptId, @Param("publishDeptId") String publishDeptId,
@Param("baseId") String baseId, @Param("baseId") String baseId,
@ -28,7 +29,8 @@ public interface KnowledgeFlowRecordMapper extends BaseMapper<KnowledgeFlowRecor
@Param("publishDateEnd") LocalDateTime publishDateEnd, @Param("publishDateEnd") LocalDateTime publishDateEnd,
Page<KnowledgeFlowResVO> page); Page<KnowledgeFlowResVO> page);
IPage<KnowledgeFlowResVO> queryKnowledgeFlowCompletePage(@Param("title") String title, IPage<KnowledgeFlowResVO> queryKnowledgeFlowCompletePage(@Param("userId") String userId,
@Param("title") String title,
@Param("publishDeptId") String publishDeptId, @Param("publishDeptId") String publishDeptId,
@Param("baseId") String baseId, @Param("baseId") String baseId,
@Param("submittedDeptId") String submittedDeptId, @Param("submittedDeptId") String submittedDeptId,

@ -48,6 +48,11 @@ public class KnowledgeFlowTodo extends Model<KnowledgeFlowTodo> implements Seria
*/ */
private String todoUserId; private String todoUserId;
/**
* ID
*/
private String submitUserId;
/** /**
* ID * ID
*/ */

@ -19,7 +19,7 @@ public interface KnowledgeFlowRecordService extends IService<KnowledgeFlowRecord
/** /**
* *
*/ */
IPage<KnowledgeFlowResVO> queryKnowledgeFlowTodoPage(String title, String publishDeptId, String baseId, IPage<KnowledgeFlowResVO> queryKnowledgeFlowTodoPage(String userId, String title, String publishDeptId, String baseId,
String submittedDeptId, Instant flowType, String submittedDeptId, Instant flowType,
LocalDateTime publishDateBegin, LocalDateTime publishDateEnd, LocalDateTime publishDateBegin, LocalDateTime publishDateEnd,
Page<KnowledgeFlowResVO> page); Page<KnowledgeFlowResVO> page);
@ -27,17 +27,18 @@ public interface KnowledgeFlowRecordService extends IService<KnowledgeFlowRecord
/** /**
* *
*/ */
IPage<KnowledgeFlowResVO> queryKnowledgeFlowCompletePage(String title, String publishDeptId, String baseId, IPage<KnowledgeFlowResVO> queryKnowledgeFlowCompletePage(String userId, String title, String publishDeptId, String baseId,
String submittedDeptId, Instant flowType, String submittedDeptId, Instant flowType,
LocalDateTime publishDateBegin, LocalDateTime publishDateEnd, LocalDateTime publishDateBegin, LocalDateTime publishDateEnd,
Page<KnowledgeFlowResVO> page); Page<KnowledgeFlowResVO> page);
/** /**
* 使- * 使-
* @param userId ID *
* @param processStatus , * @param userId ID
* @param processStatus ,
* @param knowledgeStatus * @param knowledgeStatus
*/ */
Long queryPassProcessCountByUser(String userId, Integer processStatus,Integer knowledgeStatus); Long queryPassProcessCountByUser(String userId, Integer processStatus, Integer knowledgeStatus);
} }

@ -13,30 +13,30 @@ import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* @author Administrator * @author Administrator
* @description ks_knowledge_flow_record()Service * @description ks_knowledge_flow_record()Service
* @createDate 2024-06-24 11:35:15 * @createDate 2024-06-24 11:35:15
*/ */
@Service @Service
public class KnowledgeFlowRecordServiceImpl extends ServiceImpl<KnowledgeFlowRecordMapper, KnowledgeFlowRecord> public class KnowledgeFlowRecordServiceImpl extends ServiceImpl<KnowledgeFlowRecordMapper, KnowledgeFlowRecord>
implements KnowledgeFlowRecordService{ implements KnowledgeFlowRecordService {
@Override @Override
public IPage<KnowledgeFlowResVO> queryKnowledgeFlowTodoPage(String title, String publishDeptId, String baseId, String submittedDeptId, Instant flowType, public IPage<KnowledgeFlowResVO> queryKnowledgeFlowTodoPage(String userId, String title, String publishDeptId, String baseId, String submittedDeptId, Instant flowType,
LocalDateTime publishDateBegin, LocalDateTime publishDateEnd, LocalDateTime publishDateBegin, LocalDateTime publishDateEnd,
Page<KnowledgeFlowResVO> page) { Page<KnowledgeFlowResVO> page) {
return this.baseMapper.queryKnowledgeFlowTodoPage(title, publishDeptId, baseId, submittedDeptId, flowType, publishDateBegin, publishDateEnd, page); return this.baseMapper.queryKnowledgeFlowTodoPage(userId, title, publishDeptId, baseId, submittedDeptId, flowType, publishDateBegin, publishDateEnd, page);
} }
@Override @Override
public IPage<KnowledgeFlowResVO> queryKnowledgeFlowCompletePage(String title, String publishDeptId, String baseId, String submittedDeptId, Instant flowType, public IPage<KnowledgeFlowResVO> queryKnowledgeFlowCompletePage(String userId, String title, String publishDeptId, String baseId, String submittedDeptId, Instant flowType,
LocalDateTime publishDateBegin, LocalDateTime publishDateEnd, Page<KnowledgeFlowResVO> page) { LocalDateTime publishDateBegin, LocalDateTime publishDateEnd, Page<KnowledgeFlowResVO> page) {
return this.baseMapper.queryKnowledgeFlowCompletePage(title, publishDeptId, baseId, submittedDeptId, flowType, publishDateBegin, publishDateEnd, page); return this.baseMapper.queryKnowledgeFlowCompletePage(userId, title, publishDeptId, baseId, submittedDeptId, flowType, publishDateBegin, publishDateEnd, page);
} }
@Override @Override
public Long queryPassProcessCountByUser(String userId, Integer processStatus,Integer knowledgeStatus) { public Long queryPassProcessCountByUser(String userId, Integer processStatus, Integer knowledgeStatus) {
return this.baseMapper.queryPassProcessCountByUser(userId, processStatus,knowledgeStatus); return this.baseMapper.queryPassProcessCountByUser(userId, processStatus, knowledgeStatus);
} }
} }

@ -17,10 +17,18 @@ public class KnowledgeFlowResVO {
private String title; private String title;
@Schema(description = "审批类型 1知识报送 2:知识撤回 3 知识删除") @Schema(description = "审批类型 1知识报送 2:知识撤回 3 知识删除")
private String flowType; private String flowType;
@Schema(description = "提交部门名称") @Schema(description = "发文部门名称")
private String publishDeptName;
private String publishDeptId;
@Schema(description = "报送部门名称")
private String submitDeptName; private String submitDeptName;
@Schema(description = "提交人名称")
private String submitDeptId;
@Schema(description = "报送人名称")
private String submitUserName; private String submitUserName;
private String submitUserId;
@Schema(description = "知识来源 1人工提报") @Schema(description = "知识来源 1人工提报")
private String knowledgeFrom; private String knowledgeFrom;

@ -36,39 +36,33 @@
t2.id as knowledgeId, t2.id as knowledgeId,
t2.title as title, t2.title as title,
t1.flow_type as flowType, t1.flow_type as flowType,
t4.sumitUserName as sumitUserName, t2.publish_dept_id as publishDeptId,
t4.submitDeptName as submitDeptName, t2.submitted_dept_id as submittedDeptId,
t2.knowledge_from as knowledgeFrom t1.submit_user_id as submitUserId,
from ks_knowledge_flow_todo t1 from ks_knowledge_flow_todo t1
left join ks_knowledge t2 on t1.knowledge_id = t2.id left join ks_knowledge t2 on t1.knowledge_id = t2.id
left join ks_knowledge_info t3 on t2.info_id = t3.id left join ks_knowledge_info t3 on t2.info_id = t3.id
left join (select any_value(tt2.username) as sumitUserName,
any_value(tt3.dept_name) as submitDeptName,
flow_id
from ks_knowledge_flow_record tt1
left join ks_system_user tt2 on tt1.submit_user_id = tt2.username
left join ks_system_dept tt3 on tt1.submit_dept_id = tt3.dept_name
group by flow_id) t4 on t1.flow_id = t4.flow_id and t1.flow_id = t4.flow_id
<where> <where>
t1.todo_user_id = #{userId}
<if test="title != null and title != ''"> <if test="title != null and title != ''">
where t2.title like #{title} and t2.title like #{title}
</if> </if>
<if test="title != null and title != ''"> <if test="baseId != null and baseId != ''">
and t2.base_id = #{baseId} and t2.base_id = #{baseId}
</if> </if>
<if test="title != null and title != ''"> <if test="publishDeptId != null and publishDeptId != ''">
and t2.publish_dept_id = #{publishDeptId} and t2.publish_dept_id = #{publishDeptId}
</if> </if>
<if test="title != null and title != ''"> <if test="submitted_dept_id != null and submitted_dept_id != ''">
and t2.submitted_dept_id = #{submittedDeptId} and t2.submitted_dept_id = #{submittedDeptId}
</if> </if>
<if test="title != null and title != ''"> <if test="publishDateBegin != null and publishDateBegin != ''">
and t3.publish_date <![CDATA[ >= ]]> #{publishDateBegin} and t3.publish_date <![CDATA[ >= ]]> #{publishDateBegin}
</if> </if>
<if test="title != null and title != ''"> <if test="publishDateEnd != null and publishDateEnd != ''">
and t3.publish_date <![CDATA[ <= ]]> #{publishDateEnd} and t3.publish_date <![CDATA[ <= ]]> #{publishDateEnd}
</if> </if>
<if test="title != null and title != ''"> <if test="flowType != null and flowType != ''">
and t1.flow_type = #{flowType} and t1.flow_type = #{flowType}
</if> </if>
</where> </where>
@ -81,39 +75,34 @@
t2.id as knowledgeId, t2.id as knowledgeId,
t2.title as title, t2.title as title,
t1.flow_type as flowType, t1.flow_type as flowType,
t4.sumitUserName as sumitUserName, t2.publish_dept_id as publishDeptId,
t4.submitDeptName as submitDeptName, t1.submitted_dept_id as submittedDeptId,
t1.submit_user_id as submitUserId,
t2.knowledge_from as knowledgeFrom t2.knowledge_from as knowledgeFrom
from ks_knowledge_flow_record t1 from ks_knowledge_flow_record t1
left join ks_knowledge t2 on t1.knowledge_id = t2.id left join ks_knowledge t2 on t1.knowledge_id = t2.id
left join ks_knowledge_info t3 on t2.info_id = t3.id left join ks_knowledge_info t3 on t2.info_id = t3.id
left join (select any_value(tt2.username) as sumitUserName,
any_value(tt3.dept_name) as submitDeptName,
flow_id
from ks_knowledge_flow_record tt1
left join ks_system_user tt2 on tt1.submit_user_id = tt2.username
left join ks_system_dept tt3 on tt1.submit_dept_id = tt3.dept_name
group by flow_id) t4 on t1.flow_id = t4.flow_id and t1.flow_id = t4.flow_id
<where> <where>
t1.process_user_id = #{userId}
<if test="title != null and title != ''"> <if test="title != null and title != ''">
where t2.title like #{title} and t2.title like #{title}
</if> </if>
<if test="title != null and title != ''"> <if test="baseId != null and baseId != ''">
and t2.base_id = #{baseId} and t2.base_id = #{baseId}
</if> </if>
<if test="title != null and title != ''"> <if test="publishDeptId != null and publishDeptId != ''">
and t2.publish_dept_id = #{publishDeptId} and t2.publish_dept_id = #{publishDeptId}
</if> </if>
<if test="title != null and title != ''"> <if test="submittedDeptId != null and submittedDeptId != ''">
and t2.submitted_dept_id = #{submittedDeptId} and t2.submitted_dept_id = #{submittedDeptId}
</if> </if>
<if test="title != null and title != ''"> <if test="publishDateBegin != null and publishDateBegin != ''">
and t3.publish_date <![CDATA[ >= ]]> #{publishDateBegin} and t3.publish_date <![CDATA[ >= ]]> #{publishDateBegin}
</if> </if>
<if test="title != null and title != ''"> <if test="publishDateEnd != null and publishDateEnd != ''">
and t3.publish_date <![CDATA[ <= ]]> #{publishDateEnd} and t3.publish_date <![CDATA[ <= ]]> #{publishDateEnd}
</if> </if>
<if test="title != null and title != ''"> <if test="flowType != null and flowType != ''">
and t1.flow_type = #{flowType} and t1.flow_type = #{flowType}
</if> </if>
</where> </where>

Loading…
Cancel
Save