|
|
@ -2,11 +2,14 @@ package com.yxt.anrui.terminal.biz.app; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableShareQuery; |
|
|
|
import com.yxt.anrui.flowable.api.flowcomment.FlowComment; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowRecordVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign; |
|
|
|
import com.yxt.anrui.flowable.api.processcomment.ProcessCommentDto; |
|
|
|
import com.yxt.anrui.flowable.api.processcomment.ProcessCommentFeign; |
|
|
|
import com.yxt.anrui.terminal.api.app.ShareMessageQuery; |
|
|
|
import com.yxt.anrui.terminal.api.app.flowable.*; |
|
|
|
import com.yxt.common.base.utils.StringUtils; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
@ -29,6 +32,8 @@ public class AppService { |
|
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
@Autowired |
|
|
|
private ProcessCommentFeign processCommentFeign; |
|
|
|
@Autowired |
|
|
|
private FlowableFeign flowableFeign; |
|
|
|
|
|
|
|
public ResultBean<List<AppFlowableRecordVo>> getProgressList(AppFlowableRecordQuery appFlowableRecordQuery) { |
|
|
|
ResultBean<List<AppFlowableRecordVo>> rb = ResultBean.fireFail(); |
|
|
@ -38,8 +43,8 @@ public class AppService { |
|
|
|
ResultBean<FlowRecordVo> resultBean = flowTaskFeign.businessFlowRecord(procInsId); |
|
|
|
List<AppFlowableRecordVo> voList = Optional.ofNullable(resultBean.getData().getFlowList()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), AppFlowableRecordVo.class)).collect(Collectors.toList()); |
|
|
|
voList.removeAll(Collections.singleton(null)); |
|
|
|
for (int i=0;i<voList.size();i++) { |
|
|
|
AppFlowableRecordVo vo=voList.get(i); |
|
|
|
for (int i = 0; i < voList.size(); i++) { |
|
|
|
AppFlowableRecordVo vo = voList.get(i); |
|
|
|
if (vo.getFinishTime() != null) { |
|
|
|
AppFlowCommentVo commentVo = vo.getComment(); |
|
|
|
//类型
|
|
|
@ -52,14 +57,14 @@ public class AppService { |
|
|
|
if (StringUtils.isNotBlank(stateValue)) { |
|
|
|
String processEndTime = vo.getProcessEndTime(); |
|
|
|
vo.setStateValue(stateValue); |
|
|
|
if(StringUtils.isNotBlank(processEndTime)&&i==0&&!"6".equals(type)){ |
|
|
|
if (StringUtils.isNotBlank(processEndTime) && i == 0 && !"6".equals(type)) { |
|
|
|
vo.setStateValue("已办结");//流程已办结
|
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(type)) { |
|
|
|
String processEndTime = vo.getProcessEndTime(); |
|
|
|
vo.setStateKey(type); |
|
|
|
if(StringUtils.isNotBlank(processEndTime)&&i==0&&!"6".equals(type)){ |
|
|
|
if (StringUtils.isNotBlank(processEndTime) && i == 0 && !"6".equals(type)) { |
|
|
|
vo.setStateKey("8");//流程已办结
|
|
|
|
} |
|
|
|
|
|
|
@ -68,45 +73,46 @@ public class AppService { |
|
|
|
} |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<AppFlowableRecordAndCommentVo>> getProgressAndCommentList(AppFlowableRecordQuery appFlowableRecordQuery) { |
|
|
|
ResultBean<List<AppFlowableRecordAndCommentVo>> rb = ResultBean.fireFail(); |
|
|
|
ResultBean<List<AppFlowableRecordVo>> progressdata = getProgressList(appFlowableRecordQuery); |
|
|
|
ResultBean<List<ProcessCommentVo>> commentList = getCommentList(appFlowableRecordQuery); |
|
|
|
List<AppFlowableRecordAndCommentVo> list=new ArrayList<>(); |
|
|
|
List<AppFlowableRecordAndCommentVo> list = new ArrayList<>(); |
|
|
|
List<AppFlowableRecordVo> progressList = progressdata.getData(); |
|
|
|
progressList.forEach(f->{ |
|
|
|
AppFlowableRecordAndCommentVo a=new AppFlowableRecordAndCommentVo(); |
|
|
|
a.setTime(f.getFinishTime()==null?new Date():f.getFinishTime()); |
|
|
|
// a.setTime(f.getCreateTime());
|
|
|
|
progressList.forEach(f -> { |
|
|
|
AppFlowableRecordAndCommentVo a = new AppFlowableRecordAndCommentVo(); |
|
|
|
a.setTime(f.getFinishTime() == null ? new Date() : f.getFinishTime()); |
|
|
|
// a.setTime(f.getCreateTime());
|
|
|
|
|
|
|
|
a.setFlowableRecordVo(f); |
|
|
|
a.setState(0+""); |
|
|
|
a.setState(0 + ""); |
|
|
|
list.add(a); |
|
|
|
}); |
|
|
|
|
|
|
|
commentList.getData().forEach(f->{ |
|
|
|
AppFlowableRecordAndCommentVo a=new AppFlowableRecordAndCommentVo(); |
|
|
|
commentList.getData().forEach(f -> { |
|
|
|
AppFlowableRecordAndCommentVo a = new AppFlowableRecordAndCommentVo(); |
|
|
|
Date time = f.getCreateTime(); |
|
|
|
a.setTime(time); |
|
|
|
f.setTitle(f.getTaskUserInfo().getAssigneeName()+"添加了评论"); |
|
|
|
f.setTitle(f.getTaskUserInfo().getAssigneeName() + "添加了评论"); |
|
|
|
a.setProcessCommentVo(f); |
|
|
|
a.setState(1+""); |
|
|
|
a.setState(1 + ""); |
|
|
|
list.add(a); |
|
|
|
}); |
|
|
|
list.sort((t1, t2) -> t2.getTime().compareTo(t1.getTime())); |
|
|
|
return rb.success().setData(list); |
|
|
|
return rb.success().setData(list); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<ProcessCommentVo>> getCommentList(AppFlowableRecordQuery appFlowableRecordQuery) { |
|
|
|
ResultBean<List<ProcessCommentVo>> rb = ResultBean.fireFail(); |
|
|
|
ResultBean<List<com.yxt.anrui.flowable.api.processcomment.ProcessCommentVo>> commentList = |
|
|
|
processCommentFeign.getCommentList(appFlowableRecordQuery.getProgressId()); |
|
|
|
List<ProcessCommentVo> list=new ArrayList<>(); |
|
|
|
commentList.getData().forEach(f->{ |
|
|
|
List<ProcessCommentVo> list = new ArrayList<>(); |
|
|
|
commentList.getData().forEach(f -> { |
|
|
|
ProcessCommentVo processCommentVo = new ProcessCommentVo(); |
|
|
|
BeanUtil.copyProperties(f,processCommentVo); |
|
|
|
BeanUtil.copyProperties(f, processCommentVo); |
|
|
|
processCommentVo.setCreateTime(f.getTime()); |
|
|
|
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String format = sdf.format(f.getTime()); |
|
|
|
processCommentVo.setTime(format); |
|
|
|
list.add(processCommentVo); |
|
|
@ -115,10 +121,18 @@ public class AppService { |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean addProgressComment(ProcessComment processComment) { |
|
|
|
ProcessCommentDto dto=new ProcessCommentDto(); |
|
|
|
BeanUtil.copyProperties(processComment,dto); |
|
|
|
ProcessCommentDto dto = new ProcessCommentDto(); |
|
|
|
BeanUtil.copyProperties(processComment, dto); |
|
|
|
String procInsId = processComment.getProcInsId(); |
|
|
|
dto.setProcessId(procInsId); |
|
|
|
return processCommentFeign.save(dto); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean shareMessage(ShareMessageQuery shareMessageQuery) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
FlowableShareQuery flowableShareQuery = new FlowableShareQuery(); |
|
|
|
BeanUtil.copyProperties(shareMessageQuery, flowableShareQuery); |
|
|
|
ResultBean resultBean = flowableFeign.shareFlowable(flowableShareQuery); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|