新增我的任务接口,查询当前用户的待审批、审批过的任务

dev
admin 1 year ago
parent c6a549a046
commit bd13df89b7

@ -286,7 +286,52 @@ public class FlowTaskController extends BaseController {
}
return ResultVoUtil.success(pageUtils);
}
/**
*
*
* @return
*/
@ApiOperation(value="我的任务", notes="查询我的待办、已经办理任务")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "header", name = "X-Tenant-Id", value = "租户主键,用户登录时的信息“tenantList”中获得。", dataType = "String", required = true),
})
@GetMapping("/listalldata")
@ResponseBody
public ResultVo listAlldata(PageUtils pageUtils, HttpServletRequest request){
SearchQuery searchQuery = this.getParametersStartingWithToSearchJson(request,"search_");
//租户主键,由前端页面传送
String tenantId = request.getHeader("X-Tenant-Id");
if(org.apache.commons.lang3.StringUtils.isBlank(tenantId)){
return ResultVoUtil.error("租户主键不能为空");
}
User user = this.userService.getSessionUser(request);
if(user.isUserIsSys(xiaoyaoConfig.getWebconfig().getSysLoginUser().split(","))){
flowTaskService.getMyProcessInstances(searchQuery.getQuery(),pageUtils);
}else{
flowTaskService.getMyProcessInstances(user,tenantId,searchQuery.getQuery(),pageUtils);
//待办信息,增加是否查看标记
// if(StringUtils.isNotBlank(assigneeId) && assigneeId.equals(user.getId().toString())){
//
// List list = pageUtils.getList();
// if(null != list && !list.isEmpty()){
// int count = list.size();
// for(int i = 0;i < count;i++){
// FlowUnionVo flowUnionVo = (FlowUnionVo) list.get(i);
// //flowUnionVo.setView(userViewApproeService.haveByFromid(flowUnionVo.getFormid().toString()));
// }
// }
//
// }
}
return ResultVoUtil.success(pageUtils);
}
/**
*
* @return

@ -6,6 +6,7 @@ import cn.jyjz.flowable.domain.vo.FlowTaskCompleteVO;
import cn.jyjz.flowable.domain.vo.FlowTaskVO;
import cn.jyjz.flowable.domain.vo.WorkFlowNodeVO;
import cn.jyjz.flowable.utils.PageUtils;
import cn.jyjz.xiaoyao.admin.dataobject.User;
import cn.jyjz.xiaoyao.common.base.param.ParamterPage;
import cn.jyjz.xiaoyao.common.base.vo.ResultVo;
import cn.jyjz.xiaoyao.common.base.vo.UserToken;
@ -58,6 +59,15 @@ public interface IFlowTaskService {
*/
public void getMyProcessInstances( Map<String, Object> query, PageUtils<FlowUnionVo> pageUtils);
/**
*
*
* @param user
* @param tenantId
* @param pageUtils
*/
public void getMyProcessInstances(User user,String tenantId, Map<String, Object> query,PageUtils pageUtils);
/**
*
*

@ -32,6 +32,7 @@ import cn.jyjz.xiaoyao.oa.from.service.*;
import cn.jyjz.xiaoyao.oa.from.vo.FlowUnionVo;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPicture;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPictureAppro;
import cn.jyjz.xiaoyao.ocr.service.OcrTaskchildPictureService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -1177,6 +1178,134 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
/**
*
*
* @param user
* @param tenantId
* @param pageUtils
*/
public void getMyProcessInstances(User user,String tenantId,Map<String, Object> searchQuery, PageUtils pageUtils){
ParamterPage paramterPage = new ParamterPage();
paramterPage.setStart((pageUtils.getCurrPage() - 1) * pageUtils.getPageSize());
paramterPage.setPagesize(pageUtils.getPageSize());
if(StringUtils.isNotBlank(pageUtils.getSortname())){
paramterPage.setSortname(pageUtils.getSortname());
}else{
paramterPage.setSortname("CREATEDATE");
}
if(StringUtils.isNotBlank(pageUtils.getSortorder())){
paramterPage.setSortorder(pageUtils.getSortorder());
}else{
paramterPage.setSortorder("DESC");
}
Map<String, Object> query = new HashMap<>();
query.put("page",paramterPage);
query.put("thisLoginUserid",user.getId().toString());
query.put("searchtenantid",tenantId);
//我的待办数据
query.put("searchassignee",user.getLoginname());
query.putAll(searchQuery);
Long count = ocrTaskchildPictureService.listmytaskCount(query);
query.put("page",paramterPage);
List<OcrTaskchildPictureAppro> list = ocrTaskchildPictureService.listmytask(query);
for(OcrTaskchildPictureAppro taskchildPicture:list){
//查询对应的流程分类
Category category = categoryService.selectDtoById(taskchildPicture.getCategoryid());
taskchildPicture.setCategoryDto(category);
if(StringUtils.isNotBlank(taskchildPicture.getProcessdefinitionid())){
List<Task> taskList = this.nowRunTask(taskchildPicture.getProcessinstanceid(),taskchildPicture.getProcessdefinitionid());
if(null != taskList && !taskList.isEmpty()){
taskchildPicture.setTaskId(taskList.get(0).getId());
Task tasknow =taskService.createTaskQuery().taskId(taskchildPicture.getTaskId()).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(tasknow.getProcessDefinitionId());
// 获取节点定义id
String taskDefinitionKey = tasknow.getTaskDefinitionKey();
// 根据节点定义id获取节点元素
FlowElement flowElement = bpmnModel.getFlowElement(taskDefinitionKey);
if (flowElement instanceof UserTask) {
UserTask userTask = (UserTask) flowElement;
taskchildPicture.setDocumentation(userTask.getDocumentation());
}
}
//查询历史
List<HistoricTaskInstanceDto> historicTaskInstanceDtos = new ArrayList<>();
// 查询当前任务的流转信息
List<HistoricTaskInstance> taskHiInstances = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(taskchildPicture.getProcessinstanceid())
.includeProcessVariables()
.orderByHistoricTaskInstanceStartTime()
.asc()
.list();
for (HistoricTaskInstance taskHiInstance : taskHiInstances) {
HistoricTaskInstanceDto dto = new HistoricTaskInstanceDto();
dto.setTaskId(taskHiInstance.getId());
dto.setTaskName(taskHiInstance.getName());
dto.setFinishTime(taskHiInstance.getEndTime());
if(taskHiInstance.getDurationInMillis() != null){
dto.setDuration(taskHiInstance.getDurationInMillis()/1000 + "秒");
}
dto.setTaskDefKey(taskHiInstance.getTaskDefinitionKey());
//Map<String,Object> variables = taskHiInstance.getTaskLocalVariables();
Map<String,Object> variables = taskHiInstance.getProcessVariables();
if(null != variables && null != variables.get("approvd")){
dto.setState(variables.get("approvd").toString());
}
if(StringUtils.isNotBlank(taskHiInstance.getAssignee())){
if(SystemConstantsOa.OA_TASK_SKIP_ASSIGINE.equals(taskHiInstance.getAssignee())){
dto.setAssigneeName(taskHiInstance.getAssignee());
}else{
User user1 = userService.findByLoginname(taskHiInstance.getAssignee());
dto.setAssigneeName(user1.getUsername());
}
}
BpmnModel bpmnModel = repositoryService.getBpmnModel(taskchildPicture.getProcessdefinitionid());
// // 根据节点定义id获取节点元素
FlowElement flowElement = bpmnModel.getFlowElement(taskHiInstance.getTaskDefinitionKey());
if (flowElement instanceof UserTask) {
UserTask userTask = (UserTask) flowElement;
taskchildPicture.setDocumentation(userTask.getDocumentation());
}
// 还需要根据 HistoricTaskInstance 找到对应的 审批意见
List<Comment> processInstanceComments = taskService.getProcessInstanceComments(taskchildPicture.getProcessinstanceid());
for (Comment comment : processInstanceComments) {
if(comment.getTaskId().equals(taskHiInstance.getId())){
// 审批意见
String fullMessage = comment.getFullMessage();
dto.setComment(fullMessage);
}
}
historicTaskInstanceDtos.add(dto);
}
taskchildPicture.setTransferRecords(historicTaskInstanceDtos);
}
}
pageUtils.setTotalCount(count.intValue());
pageUtils.setList(list);
}
/**
*
*

@ -2,6 +2,7 @@ package cn.jyjz.xiaoyao.ocr.dataDao;
import cn.jyjz.xiaoyao.oa.from.vo.FlowUnionVo;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPicture;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPictureAppro;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@ -27,4 +28,17 @@ public interface OcrTaskchildPictureMybatisDao extends BaseMapper<OcrTaskchildPi
* @return
*/
Long listFinalCount(Map<String, Object> query);
/**
*
* @param query
* @return
*/
public List<OcrTaskchildPictureAppro> listmytask(Map<String, Object> query);
/**
*
* @param query
* @return
*/
Long listmytaskCount(Map<String, Object> query);
}

@ -0,0 +1,172 @@
package cn.jyjz.xiaoyao.ocr.dataobject;
import cn.jyjz.flowable.domain.dto.HistoricTaskInstanceDto;
import cn.jyjz.flowable.domain.vo.FlowModelVO;
import cn.jyjz.xiaoyao.common.base.util.requestFormat.SearchQuery;
import cn.jyjz.xiaoyao.common.mybatisplus.dto.BaseDto;
import cn.jyjz.xiaoyao.oa.from.dataobject.Category;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.AbstractMap.SimpleEntry;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="任务信息", description="任务信息")
public class OcrTaskchildPictureAppro implements java.io.Serializable {
private static final long serialVersionUID = -8018660053527763810L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "比对图片主键,多个数据使用英文逗号分隔")
private String ocpictureid;
@ApiModelProperty(value = "图片比对结果,与图片主键一一对应记录比对结果使用英文逗号分隔例如99.6,98.1,97.2")
private String pictureresult;
@ApiModelProperty(value = "只记录主图,如果存在历史图片,不在这里记录")
private String picturecompare;
@ApiModelProperty(value = "所属部门")
private String deptid;
@ApiModelProperty(value = "租户ID")
private Long tenantid;
@ApiModelProperty(value = "任务包主键")
private Long packageid;
@ApiModelProperty(value = "原图片主键")
private Long pictureid;
@ApiModelProperty(value = "类型名称")
private String category;
@ApiModelProperty(value = "项目ID")
private Long categoryid;
@ApiModelProperty(value = "明细单")
private String specification;
@ApiModelProperty(value = "业务编码")
private String buessinessno;
@ApiModelProperty(value = "状态,审批状态 1:未提交 2:审批中 3:审批通过 5拒绝")
private Integer states;
@ApiModelProperty(value = "流程实例IdprocessInstanceId")
private String processinstanceid;
@ApiModelProperty(value = "流程定义id")
private String processdefinitionid;
@ApiModelProperty(value = "流程部署id")
private String deploymentid;
@ApiModelProperty(value = "审批人姓名")
private String assigneename;
@ApiModelProperty(value = "审批人")
private String assignee;
@ApiModelProperty(value = "修改人,记录创建人的帐号")
private String updateuser;
@ApiModelProperty(value = "更新时间")
private Long updatetime;
@ApiModelProperty(value = "附件")
private String fileannex;
@ApiModelProperty(value = "是否归档0未归档1归档")
private Integer guidang;
@ApiModelProperty(value = "创建人")
private String createuser;
@ApiModelProperty(value = "创建人姓名")
private String createusername;
@ApiModelProperty(value = "创建时间")
private Long createdate;
@ApiModelProperty(value = "员工主键")
private Long userid;
@ApiModelProperty(value = "员工姓名")
private String username;
@ApiModelProperty(value = "任务id,来源于图片表")
private String fromtaskid;
@ApiModelProperty(value = "任务名称,来源于图片表")
private String fromtaskname;
@ApiModelProperty(value = "提报人")
private String fromuserid;
@ApiModelProperty(value = "所属项目")
private String fromprojectid;
@ApiModelProperty(value = "所属计划")
private String fromplanid;
@ApiModelProperty(value = "提报时间")
private Long fromuptime;
@ApiModelProperty(value = "任务来源")
private String fromsourceid;
@ApiModelProperty(value = "是否为相似图片与其他图片对比为百分百的记录为10不相似1相似")
private Integer havepoints;
@ApiModelProperty(value = "当前节点名称")
private String taskname;
@ApiModelProperty(value = "历史-审批节点名称")
private String tasknamehis;
@ApiModelProperty(value = "历史-审批状态记录当前节点审批状态1.待审批 (只针对前端返回 库中逻辑上不存在) 2.通过 3.不通过")
private Integer statshis;
@ApiModelProperty(value = "历史-审批意见")
private String commenthis;
@ApiModelProperty(value = "历史-节点位置,待定字段,")
private Integer taskindex;
@ApiModelProperty(value = "历史-节点编号")
private String taskno;
@ApiModelProperty(value = "项目对象")
private Category categoryDto;
@ApiModelProperty(value = "节点主键")
private String taskId;
@ApiModelProperty(value = "节点描述")
private String documentation;
@ApiModelProperty(value = "审批记录")
private List<HistoricTaskInstanceDto> transferRecords;
}

@ -9,6 +9,7 @@ import cn.jyjz.xiaoyao.common.base.vo.UserToken;
import cn.jyjz.xiaoyao.common.mybatisplus.base.BaseService;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPicture;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPicture;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPictureAppro;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestParam;
@ -114,4 +115,13 @@ public interface OcrTaskchildPictureService extends BaseService<OcrTaskchildPict
* @return
*/
Long listFinalCount(Map<String, Object> query);
/**
*
* @param query
* @return
*/
public List<OcrTaskchildPictureAppro> listmytask(Map<String, Object> query);
public Long listmytaskCount(Map<String, Object> query);
}

@ -10,6 +10,7 @@ import cn.jyjz.xiaoyao.common.mybatisplus.util.SearchQueryFormat;
import cn.jyjz.xiaoyao.ocr.dataDao.OcrTaskchildPictureMybatisDao;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrPicture;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPicture;
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPictureAppro;
import cn.jyjz.xiaoyao.ocr.service.OcrPictureService;
import cn.jyjz.xiaoyao.ocr.service.OcrTaskchildPictureService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -489,4 +490,17 @@ public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchild
public Long listFinalCount(Map<String, Object> query){
return this.ocrtaskchildpicturemybatisdao.listFinalCount(query);
}
/**
*
* @param query
* @return
*/
public List<OcrTaskchildPictureAppro> listmytask(Map<String, Object> query){
return this.ocrtaskchildpicturemybatisdao.listmytask(query);
}
public Long listmytaskCount(Map<String, Object> query){
return this.ocrtaskchildpicturemybatisdao.listmytaskCount(query);
}
}

@ -205,4 +205,42 @@ select tcp.* from (
) as tcp
<include refid="Base_Where_union"></include>
</select>
<select id="listmytask" resultType="cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPictureAppro" parameterType="java.util.Map">
select tcp.* from (
select
tc.*,uf.COMMENTHIS,uf.TASKNAME as TASKNAMEHIS,uf.STATSHIS,uf.TASKINDEX,uf.TASKNO
from ocr_taskchild_picture tc
LEFT JOIN OA_USERAPPROVE_T uf ON tc.ID = uf.ID
where tc.ASSIGNEE = #{searchassignee} and tc.TENANTID=#{searchtenantid}
UNION
select
tc.*,uf.COMMENTHIS,uf.TASKNAME as TASKNAMEHIS,uf.STATSHIS,uf.TASKINDEX,uf.TASKNO
from ocr_taskchild_picture tc,OA_USERAPPROVE_T uf
where tc.ID = uf.FORMID and tc.TENANTID=#{searchtenantid}
<if test="thisLoginUserid != null"> and uf.USERID = #{thisLoginUserid}</if>
) as tcp
<include refid="Base_Where_union"></include>
<if test="page != null">
<if test="page.sortname != null"> order by tcp.${page.sortname} ${page.sortorder}</if>
limit ${page.start}, ${page.Pagesize}
</if>
</select>
<select id="listmytaskCount" resultType="java.lang.Long" parameterType="java.util.Map">
select count(tcp.ID) from (
select
tc.*
from ocr_taskchild_picture tc
where tc.ASSIGNEE = #{searchassignee} and tc.TENANTID=#{searchtenantid}
UNION
select
tc.*
from ocr_taskchild_picture tc,OA_USERAPPROVE_T uf
where tc.ID = uf.FORMID and tc.TENANTID=#{searchtenantid}
<if test="thisLoginUserid != null"> and uf.USERID = #{thisLoginUserid}</if>
) as tcp
<include refid="Base_Where_union"></include>
</select>
</mapper>

Loading…
Cancel
Save