feat: There is no way the
This commit is contained in:
@@ -22,8 +22,13 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessEntrustService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNameService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNewService;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.service.WebServiceOAService;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.todoContent.NotifyTodoSendContext;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppResult;
|
||||
import com.ydw.bat.wkflow.business_wkflow.form.dto.FormSubmitDto;
|
||||
import com.ydw.bat.wkflow.business_wkflow.form.service.FormValsService;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.bpmn.model.FlowNode;
|
||||
import org.activiti.engine.*;
|
||||
import org.activiti.engine.history.*;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
@@ -83,6 +88,9 @@ public class TodoTaskController extends BaseAction {
|
||||
@Autowired
|
||||
private LawsUserInfoService lawsUserInfoService;
|
||||
|
||||
@Autowired
|
||||
private WebServiceOAService webServiceOAService;
|
||||
|
||||
@ApiOperation(value = "我的待办任务列表")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "name", value = "名称"),
|
||||
@ApiImplicitParam(name = "current", value = "当前页"),
|
||||
@@ -308,6 +316,7 @@ public class TodoTaskController extends BaseAction {
|
||||
public Wrapper<String> completeTaskByUserId(@RequestBody BusMes busMes) {
|
||||
logger.info("!!!!!!!!!!!!!TaskId!!!!!!!!!!!!!!!"+busMes.getTaskId());
|
||||
logger.info("!!!!!!!!!!!!!!TaskIds!!!!!!!!!!!!!!"+busMes.getTaskIds());
|
||||
|
||||
if (busMes.getTaskId() != null && !busMes.getTaskId().equals("")) {
|
||||
if (busMes.getTaskId().indexOf(",") > -1) {
|
||||
String taskIdsrc = busMes.getTaskId().substring(0, busMes.getTaskId().length() - 1);
|
||||
@@ -327,6 +336,9 @@ public class TodoTaskController extends BaseAction {
|
||||
|
||||
formValsService.saveFormVals(formSubmitDto, task.getTaskDefinitionKey());
|
||||
|
||||
//发送OA已办
|
||||
completeOA(task);
|
||||
|
||||
taskService.complete(busMes.getTaskId());
|
||||
}
|
||||
return WrapMapper.ok(task.getProcessInstanceId());
|
||||
@@ -347,11 +359,59 @@ public class TodoTaskController extends BaseAction {
|
||||
formSubmitDto.setForm(busMes.getJson());
|
||||
formSubmitDto.setTask_id(taskId);
|
||||
formValsService.saveFormVals(formSubmitDto, task.getTaskDefinitionKey());
|
||||
//发送OA已办
|
||||
completeOA(task);
|
||||
|
||||
taskService.complete(taskId);
|
||||
}
|
||||
}
|
||||
return WrapMapper.ok(prcid);
|
||||
}
|
||||
//
|
||||
// if(notifyTodoAppResult != null){
|
||||
// if(notifyTodoAppResult.getSIGN().equals("0") && notifyTodoAppResult.getMASSAGE().equals("操作成功")){
|
||||
//
|
||||
// }else {
|
||||
// logger.error("SIGN: "+notifyTodoAppResult.getSIGN()+",MASSAGE: "+notifyTodoAppResult.getMASSAGE());
|
||||
// return WrapMapper.error("ESP 发送待办任务异常 :" +notifyTodoAppResult.getMASSAGE());
|
||||
// }
|
||||
// }else {
|
||||
// logger.error("--------------------ESP 发送待办任务异常----------------------");
|
||||
// }
|
||||
// return WrapMapper.error("ESP 发送待办任务异常");
|
||||
}
|
||||
|
||||
private void completeOA(Task task){
|
||||
logger.info("--------------------------ESP 发送已办任务----------------------------");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext();
|
||||
notifyTodoSendContext.setAppName("FOTON");
|
||||
notifyTodoSendContext.setCreateTime(sdf.format(new Date()));
|
||||
|
||||
QueryWrapper queryWrapper1 = new QueryWrapper();
|
||||
queryWrapper1.eq("P_ID",task.getProcessInstanceId());
|
||||
queryWrapper1.eq("TASK_ID",task.getId());
|
||||
List<BusProcessNew> list = iBusProcessNewService.list(queryWrapper1);
|
||||
if(!list.isEmpty()){
|
||||
notifyTodoSendContext.setModelId(list.get(0).getId());
|
||||
notifyTodoSendContext.setModelName(task.getName());
|
||||
notifyTodoSendContext.setOptType("1");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
ResponseMessage<UserVO> byId = lawsUserInfoService.getById(task.getAssignee());
|
||||
map.put("LoginName",byId == null ? "" : byId.getData().getAccount());
|
||||
JSONObject jsonLoginName = new JSONObject(map);
|
||||
notifyTodoSendContext.setTargets(jsonLoginName.toJSONString());
|
||||
NotifyTodoAppResult notifyTodoAppResult = webServiceOAService.setTodoDone(notifyTodoSendContext);
|
||||
if(notifyTodoAppResult != null){
|
||||
if(notifyTodoAppResult.getSIGN().equals("0") && notifyTodoAppResult.getMASSAGE().equals("操作成功")){
|
||||
logger.info("--------------------------成功发送 ESP 已办任务----------------------------");
|
||||
}else {
|
||||
logger.error("ESP 发送待办任务异常 :" + "SIGN: "+notifyTodoAppResult.getSIGN()+",MASSAGE: "+notifyTodoAppResult.getMASSAGE());
|
||||
}
|
||||
}else {
|
||||
logger.error("--------------------ESP 发送待办任务异常----------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询流程编号", notes = "根据流程实例ID查询流程编号")
|
||||
|
||||
+1
-1
@@ -64,6 +64,6 @@ public class WebServiceOAController extends BaseAction {
|
||||
@ApiOperation(value = "发送待办接口(")
|
||||
@PostMapping("/sendTodo")
|
||||
public NotifyTodoAppResult sendTodo(){
|
||||
return webServiceOAService.sendTodo(new NotifyTodoSendContext());
|
||||
return webServiceOAService.sendTodo(new BusProcessNew());
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -1,10 +1,13 @@
|
||||
package com.ydw.bat.wkflow.business_oa.webService.service;
|
||||
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.BusProcessNew;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.todoContent.NotifyTodoSendContext;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppResult;
|
||||
|
||||
public interface WebServiceOAService {
|
||||
|
||||
NotifyTodoAppResult sendTodo(NotifyTodoSendContext notifyTodoSendContext);
|
||||
NotifyTodoAppResult sendTodo(BusProcessNew busProcessNew);
|
||||
|
||||
NotifyTodoAppResult setTodoDone(NotifyTodoSendContext notifyTodoSendContext);
|
||||
|
||||
}
|
||||
|
||||
+75
-9
@@ -1,6 +1,10 @@
|
||||
package com.ydw.bat.wkflow.business_oa.webService.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ydw.bat.wkflow.business_auth.LawsUserInfoService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.BusProcessNew;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.ResponseMessage;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.UserVO;
|
||||
import com.ydw.bat.wkflow.business_oa.common.WebServiceConf;
|
||||
import com.ydw.bat.wkflow.business_oa.utils.OkHttpUtil;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.service.WebServiceOAService;
|
||||
@@ -13,6 +17,7 @@ import okhttp3.Credentials;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -45,17 +50,20 @@ public class WebServiceOAServiceImpl implements WebServiceOAService {
|
||||
@Autowired
|
||||
private OkHttpUtil okHttpUtil;
|
||||
|
||||
@Autowired
|
||||
private LawsUserInfoService lawsUserInfoService;
|
||||
|
||||
public WebServiceOAServiceImpl(){
|
||||
credentials = Credentials.basic(api_key,api_secret);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NotifyTodoAppResult sendTodo(NotifyTodoSendContext notifyTodoSendContext){
|
||||
@Async
|
||||
public NotifyTodoAppResult setTodoDone(NotifyTodoSendContext notifyTodoSendContext){
|
||||
NotifyTodoAppResult notifyTodoAppResult = new NotifyTodoAppResult();
|
||||
String result = "";
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
HashMap<String,Object> map = new HashMap<>();
|
||||
JsonSend jsonSend = new JsonSend();
|
||||
HEAD head = new HEAD();
|
||||
head.setACCOUNT("OA");
|
||||
@@ -71,18 +79,76 @@ public class WebServiceOAServiceImpl implements WebServiceOAService {
|
||||
net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonSend);
|
||||
Map<String,String> mapCtr = new TreeMap<>();
|
||||
mapCtr.put("Authorization",credentials);
|
||||
log.info("处理完文件数据,开始请求发送已办接口数据:【"+sdf.format(new Date())+"】");
|
||||
result = okHttpUtil.postForJson("http://172.24.12.64:85/WP_FOTON_FSOA/APP_DOC_SERVICES/Proxy_Services/TA_OA/DOC_SYC_1021_SendNotifyTodo_PS",json.toString(),mapCtr);
|
||||
log.info("请求发送已办接口完毕,返回响应状态:【"+sdf.format(new Date())+"】");
|
||||
notifyTodoAppResult = (NotifyTodoAppResult) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(result), NotifyTodoAppResult.class);
|
||||
// JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if(!result.contains("请求成功")){
|
||||
log.error("请求发送已办接口出现异常:"+result);
|
||||
}else {
|
||||
log.info("okHttp请求发送已办接口成功结果:"+result);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(errMes, e.getMessage());
|
||||
}
|
||||
|
||||
return notifyTodoAppResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public NotifyTodoAppResult sendTodo(BusProcessNew busProcessNew){
|
||||
NotifyTodoAppResult notifyTodoAppResult = new NotifyTodoAppResult();
|
||||
String result = "";
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
JsonSend jsonSend = new JsonSend();
|
||||
HEAD head = new HEAD();
|
||||
head.setACCOUNT("OA");
|
||||
head.setBIZTRANSACTIONID("SYC_161320210206133219");
|
||||
head.setCONSUMER("PCMS");
|
||||
head.setCOUNT("1");
|
||||
head.setPASSWORD("TEST_oa201611241710");
|
||||
head.setSRVLEVEL("1");
|
||||
List<Object> list = new ArrayList<>();
|
||||
NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext();
|
||||
// 待办来源的系统
|
||||
notifyTodoSendContext.setAppName("FOTON");
|
||||
//创建时间
|
||||
notifyTodoSendContext.setCreateTime(sdf.format(new Date()));
|
||||
// 待办在原系统唯一标识
|
||||
notifyTodoSendContext.setModelId(busProcessNew.getId());
|
||||
//模块名称
|
||||
notifyTodoSendContext.setModelName(busProcessNew.getTaskInfo());
|
||||
//标题
|
||||
notifyTodoSendContext.setSubject(busProcessNew.getPrcName());
|
||||
//地址
|
||||
notifyTodoSendContext.setLink("http://");
|
||||
//待办类型
|
||||
notifyTodoSendContext.setType("1");
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
ResponseMessage<UserVO> byId = lawsUserInfoService.getById(busProcessNew.getUserId());
|
||||
map.put("LoginName",byId == null ? "" : byId.getData().getAccount());
|
||||
JSONObject jsonLoginName = new JSONObject(map);
|
||||
notifyTodoSendContext.setTargets(jsonLoginName.toJSONString());
|
||||
list.add(notifyTodoSendContext);
|
||||
jsonSend.setHEAD(head);
|
||||
jsonSend.setLIST(list);
|
||||
net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonSend);
|
||||
Map<String,String> mapCtr = new TreeMap<>();
|
||||
mapCtr.put("Authorization",credentials);
|
||||
log.info("处理完文件数据,开始请求发送待办接口数据:【"+sdf.format(new Date())+"】");
|
||||
result = okHttpUtil.postForJson("http://172.24.12.64:85/WP_FOTON_FSOA/APP_DOC_SERVICES/Proxy_Services/TA_OA/DOC_SYC_1019_SendTodo_PS",json.toString(),mapCtr);
|
||||
log.info("请求发送待办接口完毕,返回响应状态:【"+sdf.format(new Date())+"】");
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
notifyTodoAppResult = (NotifyTodoAppResult) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(result), NotifyTodoAppResult.class);
|
||||
// JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if(!result.contains("请求成功")){
|
||||
log.error("请求出现异常:"+result);
|
||||
notifyTodoAppResult.setReturnSate(jsonObject.getString("SIGN"));
|
||||
notifyTodoAppResult.setMessage(jsonObject.getString("MASSAGE"));
|
||||
log.error("请求发送待办接口出现异常:"+result);
|
||||
}else {
|
||||
log.info("okHttp请求成功结果:"+result);
|
||||
notifyTodoAppResult.setReturnSate(jsonObject.getString("SIGN"));
|
||||
notifyTodoAppResult.setMessage(jsonObject.getString("MASSAGE"));
|
||||
log.info("okHttp请求发送待办接口成功结果:"+result);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
+5
@@ -64,4 +64,9 @@ public class NotifyTodoSendContext {
|
||||
@ApiModelProperty(value = "扩展参数")
|
||||
private String others;
|
||||
|
||||
// 1:表示设待办为已办操作
|
||||
//2:表示设置目标待办所属人为已办操作
|
||||
@ApiModelProperty(value = "操作类型")
|
||||
private String optType;
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,11 +12,11 @@ import lombok.Data;
|
||||
public class NotifyTodoAppResult {
|
||||
|
||||
@ApiModelProperty(value = "返回状态 0:表示未操作 1:表示操作失败 2:表示操作成功")
|
||||
private String returnSate;
|
||||
private String SIGN;
|
||||
|
||||
@ApiModelProperty(value = "返回信息 " +
|
||||
"返回状态值为0时,该值返回空 " +
|
||||
"返回状态值为1时,该值错误信息 " +
|
||||
"返回状态值为2时,该值返回空")
|
||||
private String message;
|
||||
private String MASSAGE;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.ydw.bat.wkflow.business_main.datas.entity.Datas;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNameService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNewService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IDatasService;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.service.WebServiceOAService;
|
||||
import com.ydw.bat.wkflow.util.SpringContextUtil;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
@@ -27,6 +28,7 @@ public class ApplyApplicantAfter implements TaskListener{
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
IDatasService datasService = SpringContextUtil.getBean(IDatasService.class);
|
||||
WebServiceOAService oaService = SpringContextUtil.getBean(WebServiceOAService.class);
|
||||
IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class);
|
||||
IBusProcessNameService busProcessNameService = SpringContextUtil.getBean(IBusProcessNameService.class);
|
||||
|
||||
@@ -101,6 +103,9 @@ public class ApplyApplicantAfter implements TaskListener{
|
||||
busProcessNew.setUserId(nextUser);
|
||||
busProcessNew.setPrcName(prcName);
|
||||
busBean.save(busProcessNew);
|
||||
|
||||
// 发送 oa 待办
|
||||
oaService.sendTodo(busProcessNew);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.ydw.bat.wkflow.business_main.datas.entity.Datas;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNameService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNewService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IDatasService;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.service.WebServiceOAService;
|
||||
import com.ydw.bat.wkflow.util.SpringContextUtil;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
@@ -26,6 +27,7 @@ public class CountersignAfter implements TaskListener{
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
IDatasService datasService = SpringContextUtil.getBean(IDatasService.class);
|
||||
WebServiceOAService oaService = SpringContextUtil.getBean(WebServiceOAService.class);
|
||||
IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class);
|
||||
IBusProcessNameService busProcessNameService = SpringContextUtil.getBean(IBusProcessNameService.class);
|
||||
|
||||
@@ -100,6 +102,9 @@ public class CountersignAfter implements TaskListener{
|
||||
busProcessNew.setUserId(nextUser);
|
||||
busProcessNew.setPrcName(prcName);
|
||||
busBean.save(busProcessNew);
|
||||
|
||||
// 发送 oa 待办
|
||||
oaService.sendTodo(busProcessNew);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.ydw.bat.wkflow.business_main.datas.entity.Datas;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNameService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNewService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.service.IDatasService;
|
||||
import com.ydw.bat.wkflow.business_oa.webService.service.WebServiceOAService;
|
||||
import com.ydw.bat.wkflow.util.SpringContextUtil;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
@@ -29,6 +30,7 @@ public class SLApplicantAfter implements TaskListener{
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
IDatasService datasService = SpringContextUtil.getBean(IDatasService.class);
|
||||
IBusProcessNewService busBean = SpringContextUtil.getBean(IBusProcessNewService.class);
|
||||
WebServiceOAService oaService = SpringContextUtil.getBean(WebServiceOAService.class);
|
||||
IBusProcessNameService busProcessNameService = SpringContextUtil.getBean(IBusProcessNameService.class);
|
||||
|
||||
QueryWrapper<Datas> queryWrapper = new QueryWrapper<>();
|
||||
@@ -125,6 +127,8 @@ public class SLApplicantAfter implements TaskListener{
|
||||
busProcessNewNext.setUserId(nextUser);
|
||||
busProcessNewNext.setPrcName(prcName);
|
||||
busBean.save(busProcessNewNext);
|
||||
// 发送 oa 待办
|
||||
oaService.sendTodo(busProcessNewNext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user