获取dingding审批实例
程序员文章站
2022-06-24 20:34:45
...
获取DD审批实例首先继承DD回调服务接口
public interface DingTalkService extends DingTalkCallBackBaseService {
}
然后在impl层重写方法 agree/disAgree/left/start
//同意
@Override
public void agree(String processInstanceId, String remark) {
ServiceResult processinstanceById01 = processinstanceController.getProcessinstanceById(processInstanceId);
OapiProcessinstanceGetResponse.ProcessInstanceTopVo result = (OapiProcessinstanceGetResponse.ProcessInstanceTopVo) processinstanceById01.getResult();
//获取DD的审批状态 判断
if (result.getStatus().equals(ProcessinstanceController.RUNNING)) {
return;
}
MmsDingAccessories mmsDingAccessories = new MmsDingAccessories();
List<OapiProcessinstanceGetResponse.FormComponentValueVo> formComponentValues = result.getFormComponentValues();
//发起人
String userid = result.getOriginatorUserid();
List<User> user = iUserService.selectList(new EntityWrapper<User>().eq("dingtalk_id", userid));
//获得发起部门
String originatorDeptName = result.getOriginatorDeptName();
String originatorDeptId = result.getOriginatorDeptId();
List<String> ccUserids = result.getCcUserids();
List<String> approverUserids = result.getApproverUserids();
if (ccUserids!=null){
String ccUserid = ccUserids.toString().replace("[", "").replace("]", "");
mmsDingAccessories.setCopyUserids(ccUserid);
}
if (approverUserids!=null){
String approverUserid = approverUserids.toString().replace("[", "").replace("]", "");
mmsDingAccessories.setApproverUserids(approverUserid);
}
mmsDingAccessories.setDingTalkId(processInstanceId);
for (OapiProcessinstanceGetResponse.FormComponentValueVo formComponentValue : formComponentValues) {
String name = formComponentValue.getName();
String value = formComponentValue.getValue();
if ("部门".equals(name)) {
mmsDingAccessories.setDepart(value);
mmsDingAccessories.setDate(new Date());
} else if ("姓名".equals(name)) {
if (user.size()==1){
mmsDingAccessories.setProposerId(user.get(0).getId());
}
mmsDingAccessories.setProposerName(value);
}
}
String uuid = UUIDGenerator.getUUID();
mmsDingAccessories.setId(uuid);
mmsDingAccessories.insert();
}
不知道为什么在获得审批人那时候获取不到,有知道的大佬回复一下,感谢!!
下一篇: Android 定时启动dingding