丽知:钉钉回调
This commit is contained in:
parent
2643dd64d1
commit
0519a067f0
|
@ -245,10 +245,69 @@ public class CallBackServiceImpl implements CallBackService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调拨单内部交易(付款单)->特殊业务处理(新)
|
||||
* 回调,审核付款单
|
||||
* 两种业务场景
|
||||
* 1、付款单审核
|
||||
* 2、付款单新增
|
||||
*/
|
||||
public void transferBill(JSONObject eventJson) throws Exception{
|
||||
//获取token
|
||||
String token = getDingTalkToken();
|
||||
try {
|
||||
//获取token
|
||||
String token = getDingTalkToken();
|
||||
//实例ID
|
||||
String processInstanceId = eventJson.getString("processInstanceId");
|
||||
DingU8cBillEntity dingU8cBillEntity = queryU8CDing(processInstanceId);
|
||||
if (dingU8cBillEntity == null) {
|
||||
//新增
|
||||
addArapBill(processInstanceId);
|
||||
}else {
|
||||
//查询实例的具体信息
|
||||
GetProcessInstanceResponse processInstanceDetails = DingTalkUtils.getProcessInstanceDetails(token, processInstanceId);
|
||||
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResult processInstanceResponseBodyResult = processInstanceDetails.getBody().getResult();
|
||||
//审批状态,该回调事件只监听,审批完成的
|
||||
if (processInstanceResponseBodyResult.getStatus().equals("RUNNING")) {//审批中
|
||||
logger.info("特殊业务处理(新)--->审批中");
|
||||
} else if (processInstanceResponseBodyResult.getStatus().equals("TERMINATED")) {//已撤销
|
||||
logger.info("特殊业务处理(新)--->已撤销");
|
||||
} else if (processInstanceResponseBodyResult.getStatus().equals("COMPLETED")) {//审批完成
|
||||
logger.info("特殊业务处理(新)--->审批完成");
|
||||
}
|
||||
//获取所有审批意见
|
||||
List<GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultOperationRecords> operationRecords = processInstanceResponseBodyResult.getOperationRecords();
|
||||
|
||||
//审批意见过滤掉:START_PROCESS_INSTANCE:发起流程实例
|
||||
operationRecords = operationRecords.stream().filter(item -> !item.getType().equals("START_PROCESS_INSTANCE")).collect(Collectors.toList());
|
||||
System.out.println(operationRecords);
|
||||
|
||||
String remark = "";
|
||||
//钉钉问题记录执行明细
|
||||
for (GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultOperationRecords operationRecord : operationRecords) {
|
||||
//操作结果
|
||||
switch (operationRecord.getResult()) {
|
||||
case "AGREE":
|
||||
dingU8cBillEntity.setDing_res("同意");
|
||||
break;
|
||||
case "REFUSE":
|
||||
dingU8cBillEntity.setDing_res("拒绝");
|
||||
break;
|
||||
case "NONE":
|
||||
dingU8cBillEntity.setDing_res("未处理");
|
||||
break;
|
||||
}
|
||||
//处理意见
|
||||
remark = operationRecord.getRemark();
|
||||
}
|
||||
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||
|
||||
//审批u8c单据
|
||||
approveArapDjzb(dingU8cBillEntity, remark);
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
|
@ -287,17 +346,26 @@ public class CallBackServiceImpl implements CallBackService {
|
|||
}
|
||||
//成功
|
||||
dingU8cBillEntity.setApprove("Y");
|
||||
dingU8cBillDao.save(dingU8cBillEntity);
|
||||
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||
}catch (Exception e){
|
||||
logger.error("推送U8C--> 丽知:审核付款单审核 失败"+e);
|
||||
//失败
|
||||
dingU8cBillEntity.setApprove("N");
|
||||
dingU8cBillEntity.setPushInfo(e.getMessage());
|
||||
dingU8cBillDao.save(dingU8cBillEntity);
|
||||
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 付款单新增
|
||||
*/
|
||||
public void addArapBill(String processInstanceId) throws Exception {
|
||||
//查询实例的具体信息
|
||||
GetProcessInstanceResponse processInstanceDetails = DingTalkUtils.getProcessInstanceDetails(token, processInstanceId);
|
||||
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResult processInstanceResponseBodyResult = processInstanceDetails.getBody().getResult();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Map bills=new HashMap();
|
||||
bills.put("djbh","FK2108160001");
|
||||
|
|
|
@ -86,7 +86,7 @@ public class FileUtil {
|
|||
}
|
||||
//2.3调用提交文件接口,完成文件上传。
|
||||
CommitFileRequest.CommitFileRequestOptionAppProperties commitFileRequestOptionAppProperties = new CommitFileRequest.CommitFileRequestOptionAppProperties();
|
||||
commitFileRequestOptionAppProperties.setName(fileVO.getFileName()+"."+fileVO.getType());
|
||||
commitFileRequestOptionAppProperties.setName(fileVO.getFileName());
|
||||
commitFileRequestOptionAppProperties.setValue(fileVO.getFileName());
|
||||
commitFileRequestOptionAppProperties.setVisibility("PUBLIC");//属性可见性。 - PUBLIC:所有应用都可见 - PRIVATE:仅限当前应用可见
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class FileUtil {
|
|||
|
||||
//4.组装钉钉文件控件-->"[{\"spaceId\": \"163xxxx658\", \"fileName\": \"2644.JPG\", \"fileSize\": \"333\", \"fileType\": \"jpg\", \"fileId\": \"643xxxx140\"}]"
|
||||
fileModuleVO.setSpaceId(spaceId);
|
||||
fileModuleVO.setFileName(fileVO.getFileName()+"."+fileVO.getType());
|
||||
fileModuleVO.setFileName(fileVO.getFileName());
|
||||
fileModuleVO.setFileSize(fileVO.getFileSize());
|
||||
fileModuleVO.setFileType(fileVO.getType());//取后缀
|
||||
fileModuleVO.setFileId(dingFileUniqueId);
|
||||
|
|
Loading…
Reference in New Issue