feat: There is no way the
This commit is contained in:
@@ -223,6 +223,7 @@ public class TodoTaskController extends BaseAction {
|
|||||||
List<BusProcessNew> list1 = iBusProcessNewService.list(queryWrapper1);
|
List<BusProcessNew> list1 = iBusProcessNewService.list(queryWrapper1);
|
||||||
if (list1.size() > 0) {
|
if (list1.size() > 0) {
|
||||||
for (BusProcessNew busProcessNew : list1) {
|
for (BusProcessNew busProcessNew : list1) {
|
||||||
|
webServiceOAService.deleteOAByTaskIdResetTodo(busProcessNew,assignee);
|
||||||
busProcessNew.setUserId(assignee);
|
busProcessNew.setUserId(assignee);
|
||||||
iBusProcessNewService.saveOrUpdate(busProcessNew);
|
iBusProcessNewService.saveOrUpdate(busProcessNew);
|
||||||
}
|
}
|
||||||
@@ -240,86 +241,86 @@ public class TodoTaskController extends BaseAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//发送邮件
|
//发送邮件
|
||||||
QueryWrapper queryWrapper = new QueryWrapper();
|
// QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
queryWrapper.eq("PRC_ID", pId);
|
// queryWrapper.eq("PRC_ID", pId);
|
||||||
BusProcessName name = iBusProcessNameService.getOne(queryWrapper);
|
// BusProcessName name = iBusProcessNameService.getOne(queryWrapper);
|
||||||
String type = name.getPrcType();
|
// String type = name.getPrcType();
|
||||||
Integer typeInt = 99;
|
// Integer typeInt = 99;
|
||||||
if (StringUtils.isNotEmpty(type)){
|
// if (StringUtils.isNotEmpty(type)){
|
||||||
typeInt = Integer.valueOf(type);
|
// typeInt = Integer.valueOf(type);
|
||||||
}
|
// }
|
||||||
switch (typeInt){
|
// switch (typeInt){
|
||||||
case 1:
|
// case 1:
|
||||||
type = "法规入库及评估流程";
|
// type = "法规入库及评估流程";
|
||||||
break;
|
// break;
|
||||||
case 2:
|
// case 2:
|
||||||
type = "标准法规技术储备评估流程";
|
// type = "标准法规技术储备评估流程";
|
||||||
break;
|
// break;
|
||||||
case 3:
|
// case 3:
|
||||||
type = "项目评估流程";
|
// type = "项目评估流程";
|
||||||
break;
|
// break;
|
||||||
case 4:
|
// case 4:
|
||||||
type = "企标制修订流程";
|
// type = "企标制修订流程";
|
||||||
break;
|
// break;
|
||||||
case 5:
|
// case 5:
|
||||||
type = "未符合项跟踪流程";
|
// type = "未符合项跟踪流程";
|
||||||
break;
|
// break;
|
||||||
case 6:
|
// case 6:
|
||||||
type = "企标制修订申请流程";
|
// type = "企标制修订申请流程";
|
||||||
break;
|
// break;
|
||||||
case 7:
|
// case 7:
|
||||||
type = "企标废止流程";
|
// type = "企标废止流程";
|
||||||
break;
|
// break;
|
||||||
case 8:
|
// case 8:
|
||||||
type = "企标延期制修订申请流程";
|
// type = "企标延期制修订申请流程";
|
||||||
break;
|
// break;
|
||||||
case 9:
|
// case 9:
|
||||||
type = "标准采购流程";
|
// type = "标准采购流程";
|
||||||
break;
|
// break;
|
||||||
case 10:
|
// case 10:
|
||||||
type = "工作组会前申请流程";
|
// type = "工作组会前申请流程";
|
||||||
break;
|
// break;
|
||||||
case 11:
|
// case 11:
|
||||||
type = "企标制修订评估流程";
|
// type = "企标制修订评估流程";
|
||||||
break;
|
// break;
|
||||||
case 12:
|
// case 12:
|
||||||
type = "企标勘误流程";
|
// type = "企标勘误流程";
|
||||||
break;
|
// break;
|
||||||
case 13:
|
// case 13:
|
||||||
type = "行政管理要求评估流程";
|
// type = "行政管理要求评估流程";
|
||||||
break;
|
// break;
|
||||||
case 14:
|
// case 14:
|
||||||
type = "政策入库及评估流程";
|
// type = "政策入库及评估流程";
|
||||||
break;
|
// break;
|
||||||
case 15:
|
// case 15:
|
||||||
type = "标准翻译申请流程";
|
// type = "标准翻译申请流程";
|
||||||
break;
|
// break;
|
||||||
case 16:
|
// case 16:
|
||||||
type = "工作组会后管理流程";
|
// type = "工作组会后管理流程";
|
||||||
break;
|
// break;
|
||||||
case 17:
|
// case 17:
|
||||||
type = "企标备案流程";
|
// type = "企标备案流程";
|
||||||
break;
|
// break;
|
||||||
case 18:
|
// case 18:
|
||||||
type = "标准法规清单发布/更新流程";
|
// type = "标准法规清单发布/更新流程";
|
||||||
break;
|
// break;
|
||||||
case 19:
|
// case 19:
|
||||||
type = "企标复审流程";
|
// type = "企标复审流程";
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
ResponseMessage<UserVO> userVOResponseMessage = lawsUserInfoService.getById(userId);
|
// ResponseMessage<UserVO> userVOResponseMessage = lawsUserInfoService.getById(userId);
|
||||||
UserVO userVO = userVOResponseMessage.getData();
|
// UserVO userVO = userVOResponseMessage.getData();
|
||||||
String userName = "";
|
// String userName = "";
|
||||||
if (null != userVO) {
|
// if (null != userVO) {
|
||||||
userName = userVO.getUname();
|
// userName = userVO.getUname();
|
||||||
}
|
// }
|
||||||
String content = "您好,"+name.getPrcNum()+"-"+ name.getPrcName() +" "+ userName +"委托您处理待办任务 ,请登录全球标准法规管理系统 ( http://39.98.140.126:10005/#/login ) 办理:链接( http://39.98.140.126:10005/#/processCenter?tabsName=ProcessCenter )。\n" +
|
// String content = "您好,"+name.getPrcNum()+"-"+ name.getPrcName() +" "+ userName +"委托您处理待办任务 ,请登录全球标准法规管理系统 ( http://39.98.140.126:10005/#/login ) 办理:链接( http://39.98.140.126:10005/#/processCenter?tabsName=ProcessCenter )。\n" +
|
||||||
" ——来自 全球标准法规管理系统";
|
// " ——来自 全球标准法规管理系统";
|
||||||
lawsUserInfoService.sendEmail(userId,content,"GSRM——【待办任务】["+type+"]有您的待办任务");
|
// lawsUserInfoService.sendEmail(userId,content,"GSRM——【待办任务】["+type+"]有您的待办任务");
|
||||||
|
//
|
||||||
logger.info("task {} find " + taskId);
|
// logger.info("task {} find " + taskId);
|
||||||
return WrapMapper.ok("改派成功");
|
return WrapMapper.ok("改派成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2290,6 +2291,9 @@ public class TodoTaskController extends BaseAction {
|
|||||||
@GetMapping("/forceRecall")
|
@GetMapping("/forceRecall")
|
||||||
public Wrapper<String> forceRecall(String prcId) {
|
public Wrapper<String> forceRecall(String prcId) {
|
||||||
runtimeService.deleteProcessInstance(prcId, "用户强制撤回");
|
runtimeService.deleteProcessInstance(prcId, "用户强制撤回");
|
||||||
|
if(StringUtils.isNotBlank(prcId)){
|
||||||
|
webServiceOAService.deleteOAByPid(prcId);
|
||||||
|
}
|
||||||
Map map = new HashMap();
|
Map map = new HashMap();
|
||||||
map.put("P_ID", prcId);
|
map.put("P_ID", prcId);
|
||||||
iBusProcessNewService.removeByMap(map);
|
iBusProcessNewService.removeByMap(map);
|
||||||
|
|||||||
@@ -20,6 +20,20 @@ public class CreateMQService {
|
|||||||
@Value("${oa.flag}")
|
@Value("${oa.flag}")
|
||||||
private Boolean oaFlag;
|
private Boolean oaFlag;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: super_liu
|
||||||
|
* @date: 2021年09月17日 14:40
|
||||||
|
**/
|
||||||
|
public void setTodoDeleteMq(String object){
|
||||||
|
|
||||||
|
if(oaFlag){
|
||||||
|
//发送消息队列
|
||||||
|
this.rabbitTemplate.convertAndSend("sendDelete-exchange_MQ_GSAR", "sendDelete-key_MQ_GSAR", object);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: super_liu
|
* @author: super_liu
|
||||||
* @date: 2021年09月17日 14:40
|
* @date: 2021年09月17日 14:40
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
package com.ydw.bat.wkflow.business_mq.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import com.ydw.bat.wkflow.business_auth.LawsUserInfoService;
|
||||||
|
import com.ydw.bat.wkflow.business_main.datas.entity.ResponseMessage;
|
||||||
|
import com.ydw.bat.wkflow.business_main.datas.entity.SendTodoLog;
|
||||||
|
import com.ydw.bat.wkflow.business_main.datas.entity.UserVO;
|
||||||
|
import com.ydw.bat.wkflow.business_main.datas.mapper.SendTodoLogMapper;
|
||||||
|
import com.ydw.bat.wkflow.business_main.datas.service.ISendTodoLogService;
|
||||||
|
import com.ydw.bat.wkflow.business_oa.utils.EmailUtils;
|
||||||
|
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.NotifyTodoAppDeleteResult;
|
||||||
|
import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppResult;
|
||||||
|
import net.sf.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.amqp.support.AmqpHeaders;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.messaging.Message;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class SendDeleteMQService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SendDeleteMQService.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CreateMQService convertMq;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmailUtils emailUtils;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WebServiceOAService webServiceOAService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SendTodoLogMapper sendTodoLogMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LawsUserInfoService lawsUserInfoService;
|
||||||
|
|
||||||
|
@RabbitListener(bindings = @QueueBinding(
|
||||||
|
value = @Queue(value = "createMQDelete_SQ_GSAR", durable = "true"),
|
||||||
|
exchange = @Exchange(value = "sendDelete-exchange_MQ_GSAR", ignoreDeclarationExceptions = "true"),
|
||||||
|
key = "sendDelete-key_MQ_GSAR"))
|
||||||
|
public void createMQDone(String object, Message message, Channel channel) throws Exception{
|
||||||
|
try{
|
||||||
|
try{
|
||||||
|
Thread.sleep(5000);
|
||||||
|
insertOrUpdateInfo(object);
|
||||||
|
}catch(InterruptedException e){
|
||||||
|
logger.error(e.toString());
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("消息队列进入添加数据方法前失败!");
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
}finally {
|
||||||
|
Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||||
|
channel.basicAck(tag,false);
|
||||||
|
logger.debug("消息确认成功!!!!!!!!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertOrUpdateInfo(String object) throws Exception {
|
||||||
|
Map<String,Object> objectMap = JSONObject.fromObject(object);
|
||||||
|
String todoId = objectMap.get("todoId").toString();
|
||||||
|
try {
|
||||||
|
NotifyTodoAppDeleteResult todoAppResult = webServiceOAService.setTodoDelete(object);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
if(todoAppResult.getSign().equals("0") || todoAppResult.getMassage().equals("操作成功")){
|
||||||
|
logger.info("--------------------------成功发送 ESP 已办任务----------------------------");
|
||||||
|
QueryWrapper wrapper = new QueryWrapper();
|
||||||
|
wrapper.eq("TODO_ID",todoId);
|
||||||
|
wrapper.eq("MSG_TYPE","3");
|
||||||
|
List<SendTodoLog> list = sendTodoLogMapper.selectList(wrapper);
|
||||||
|
if(!list.isEmpty()) {
|
||||||
|
SendTodoLog sendTodoLog = list.get(0);
|
||||||
|
sendTodoLog.setOperMesg(todoAppResult.getMassage());
|
||||||
|
sendTodoLog.setMsgStatus("3");
|
||||||
|
sendTodoLog.setCreateTime(sdf.format(new Date()));
|
||||||
|
sendTodoLog.setUpdateTime(sdf.format(new Date()));
|
||||||
|
sendTodoLogMapper.updateById(sendTodoLog);
|
||||||
|
}else {
|
||||||
|
sendTodoSave(object,todoId, sdf, "2",todoAppResult.getMassage());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
logger.error("ESP 发送待办任务异常 :" + "SIGN: "+todoAppResult.getSign()+",MASSAGE: "+todoAppResult.getMassage());
|
||||||
|
// 重试发送待办
|
||||||
|
logger.info("重试发送待办");
|
||||||
|
this.restartSendMq(object,todoId,todoAppResult.getMassage());
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
this.restartSendMq(object,todoId, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restartSendMq(String object,String todoId,String operMesg) throws Exception{
|
||||||
|
QueryWrapper wrapper = new QueryWrapper();
|
||||||
|
wrapper.eq("TODO_ID",todoId);
|
||||||
|
wrapper.eq("MSG_TYPE","3");
|
||||||
|
List<SendTodoLog> list = sendTodoLogMapper.selectList(wrapper);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||||
|
if(!list.isEmpty()){
|
||||||
|
SendTodoLog sendTodoLog = list.get(0);
|
||||||
|
int againNumNew = Integer.valueOf(sendTodoLog.getErrNum());
|
||||||
|
if(againNumNew >= 6){
|
||||||
|
// 发送待办 或 发送给管理员邮箱
|
||||||
|
logger.info("发送失败6次,发送给管理员邮箱");
|
||||||
|
List<String> emailList = new ArrayList<>();
|
||||||
|
ResponseMessage<UserVO> byId = lawsUserInfoService.getById("WY8J26MH23");
|
||||||
|
// 占时指定admin用户邮箱
|
||||||
|
emailList.add(byId == null ? "" : (byId.getData().getEmail() != null ? byId.getData().getEmail() : ""));
|
||||||
|
String[] arr = emailList.toArray(new String[emailList.size()]);
|
||||||
|
String title = "OA请求发送失败6次";
|
||||||
|
String countText = "<div style=\"font-size:16px\" ><div><p>您好:</p></div>" +
|
||||||
|
"<span style=\"color:blue;\" >"+"OA请求发送失败6次,请线下协调处理"+"</span></div>";
|
||||||
|
emailUtils.sendMsgFeign(arr,title,countText);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
restSendDoneTodo(object, sdf, sendTodoLog, againNumNew,operMesg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
sendTodoSave(object,todoId, sdf, "3",operMesg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restSendDoneTodo(String object, SimpleDateFormat sdf, SendTodoLog sendTodoLog, int againNumNew,String operMesg) throws Exception{
|
||||||
|
// 发送失败连续持续3次, 如果在失败等待1个小时后重试3次
|
||||||
|
if(againNumNew < 6){
|
||||||
|
Thread.sleep(3000);
|
||||||
|
logger.info("发送失败连续持续"+againNumNew+"次,存入延迟重试队列!!!!!!!!!");
|
||||||
|
|
||||||
|
}else {
|
||||||
|
logger.info("发送失败连续持续"+againNumNew+"次!!");
|
||||||
|
}
|
||||||
|
sendTodoLog.setErrNum(sendTodoLog.getErrNum()+1);
|
||||||
|
sendTodoLog.setUpdateTime(sdf.format(new Date()));
|
||||||
|
sendTodoLog.setOperMesg(operMesg);
|
||||||
|
sendTodoLogMapper.updateById(sendTodoLog);
|
||||||
|
convertMq.setTodoDeleteMq(object);
|
||||||
|
logger.info("已重新加入延迟队列");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendTodoSave(String object, String todoId, SimpleDateFormat sdf, String s,String operMesg) {
|
||||||
|
SendTodoLog sendTodoLog = new SendTodoLog();
|
||||||
|
sendTodoLog.setMsgType("3");
|
||||||
|
sendTodoLog.setTodoId(todoId);
|
||||||
|
sendTodoLog.setMesg(object);
|
||||||
|
sendTodoLog.setMsgStatus(s);
|
||||||
|
sendTodoLog.setErrNum(1);
|
||||||
|
sendTodoLog.setOperMesg(operMesg);
|
||||||
|
sendTodoLog.setCreateTime(sdf.format(new Date()));
|
||||||
|
sendTodoLog.setUpdateTime(sdf.format(new Date()));
|
||||||
|
sendTodoLogMapper.insert(sendTodoLog);
|
||||||
|
if(s.equals("2")){
|
||||||
|
logger.info("发送成功,存入OA日志");
|
||||||
|
}else{
|
||||||
|
convertMq.setTodoDeleteMq(object);
|
||||||
|
logger.info("已重新加入延迟队列");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+9
@@ -2,15 +2,24 @@ 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_main.datas.entity.BusProcessNew;
|
||||||
import com.ydw.bat.wkflow.business_oa.webService.todoContent.NotifyTodoSendContext;
|
import com.ydw.bat.wkflow.business_oa.webService.todoContent.NotifyTodoSendContext;
|
||||||
|
import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppDeleteResult;
|
||||||
import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppResult;
|
import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppResult;
|
||||||
import org.activiti.engine.task.Task;
|
import org.activiti.engine.task.Task;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface WebServiceOAService {
|
public interface WebServiceOAService {
|
||||||
|
|
||||||
|
void deleteOAByPid(String pId);
|
||||||
|
|
||||||
|
void deleteOAByTaskIdResetTodo(BusProcessNew busProcessNew,String assignee);
|
||||||
|
|
||||||
void completeOA(Task task);
|
void completeOA(Task task);
|
||||||
|
|
||||||
NotifyTodoAppResult sendTodo(BusProcessNew busProcessNew) throws Exception;
|
NotifyTodoAppResult sendTodo(BusProcessNew busProcessNew) throws Exception;
|
||||||
|
|
||||||
NotifyTodoAppResult setTodoDone(NotifyTodoSendContext notifyTodoSendContext) throws Exception;
|
NotifyTodoAppResult setTodoDone(NotifyTodoSendContext notifyTodoSendContext) throws Exception;
|
||||||
|
|
||||||
|
NotifyTodoAppDeleteResult setTodoDelete(String object) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+142
-4
@@ -1,12 +1,11 @@
|
|||||||
package com.ydw.bat.wkflow.business_oa.webService.service.impl;
|
package com.ydw.bat.wkflow.business_oa.webService.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.ydw.bat.wkflow.business_auth.LawsUserInfoService;
|
import com.ydw.bat.wkflow.business_auth.LawsUserInfoService;
|
||||||
import com.ydw.bat.wkflow.business_main.datas.entity.BusProcessName;
|
import com.ydw.bat.wkflow.business_main.datas.entity.*;
|
||||||
import com.ydw.bat.wkflow.business_main.datas.entity.BusProcessNew;
|
import com.ydw.bat.wkflow.business_main.datas.mapper.SendTodoLogMapper;
|
||||||
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_main.datas.service.IBusProcessNameService;
|
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.IBusProcessNewService;
|
||||||
import com.ydw.bat.wkflow.business_mq.service.CreateMQService;
|
import com.ydw.bat.wkflow.business_mq.service.CreateMQService;
|
||||||
@@ -16,11 +15,13 @@ import com.ydw.bat.wkflow.business_oa.webService.service.WebServiceOAService;
|
|||||||
import com.ydw.bat.wkflow.business_oa.webService.todoContent.HEAD;
|
import com.ydw.bat.wkflow.business_oa.webService.todoContent.HEAD;
|
||||||
import com.ydw.bat.wkflow.business_oa.webService.todoContent.JsonSend;
|
import com.ydw.bat.wkflow.business_oa.webService.todoContent.JsonSend;
|
||||||
import com.ydw.bat.wkflow.business_oa.webService.todoContent.NotifyTodoSendContext;
|
import com.ydw.bat.wkflow.business_oa.webService.todoContent.NotifyTodoSendContext;
|
||||||
|
import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppDeleteResult;
|
||||||
import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppResult;
|
import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppResult;
|
||||||
import com.ydw.bat.wkflow.util.SpringContextUtil;
|
import com.ydw.bat.wkflow.util.SpringContextUtil;
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import okhttp3.Credentials;
|
import okhttp3.Credentials;
|
||||||
import org.activiti.engine.task.Task;
|
import org.activiti.engine.task.Task;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -59,6 +60,9 @@ public class WebServiceOAServiceImpl implements WebServiceOAService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OkHttpUtil okHttpUtil;
|
private OkHttpUtil okHttpUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SendTodoLogMapper sendTodoLogMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LawsUserInfoService lawsUserInfoService;
|
private LawsUserInfoService lawsUserInfoService;
|
||||||
|
|
||||||
@@ -72,6 +76,140 @@ public class WebServiceOAServiceImpl implements WebServiceOAService {
|
|||||||
credentials = Credentials.basic(api_key,api_secret);
|
credentials = Credentials.basic(api_key,api_secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单个删除OA待办 及 重发待办
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Async
|
||||||
|
public void deleteOAByTaskIdResetTodo(BusProcessNew busProcessNew,String assignee){
|
||||||
|
CreateMQService oaService = SpringContextUtil.getBean(CreateMQService.class);
|
||||||
|
log.info("--------------------------ESP 发送删除待办任务 及 再次发送待办----------------------------");
|
||||||
|
|
||||||
|
if(busProcessNew != null && StringUtils.isNotBlank(busProcessNew.getId())){
|
||||||
|
|
||||||
|
QueryWrapper wrapper = new QueryWrapper();
|
||||||
|
wrapper.eq("TODO_ID",busProcessNew.getId());
|
||||||
|
wrapper.eq("MSG_TYPE","0");
|
||||||
|
List<SendTodoLog> list = sendTodoLogMapper.selectList(wrapper);
|
||||||
|
if(!list.isEmpty()){
|
||||||
|
net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(list.get(0).getMesg());
|
||||||
|
net.sf.json.JSONObject jsonObjectFilter = net.sf.json.JSONObject.fromObject(list.get(0).getMesg());
|
||||||
|
jsonObjectFilter = jsonObjectFilter.discard("PId");
|
||||||
|
jsonObjectFilter.put("pid",fromObject.getString("PId"));
|
||||||
|
BusProcessNew object = JSON.parseObject(jsonObjectFilter.toString(),BusProcessNew.class);
|
||||||
|
|
||||||
|
List<NotifyTodoSendContext> notifyTodoSendContexts = new ArrayList<>();
|
||||||
|
NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext();
|
||||||
|
notifyTodoSendContext.setAppName("FOTON");
|
||||||
|
notifyTodoSendContext.setModelId(busProcessNew.getId());
|
||||||
|
notifyTodoSendContext.setModelName(object.getTaskInfo());
|
||||||
|
notifyTodoSendContext.setType("1");
|
||||||
|
notifyTodoSendContext.setOptType("2");
|
||||||
|
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());
|
||||||
|
notifyTodoSendContext.setUserId(busProcessNew.getUserId());
|
||||||
|
notifyTodoSendContexts.add(notifyTodoSendContext);
|
||||||
|
Map<String,Object> objectMap = new TreeMap<>();
|
||||||
|
objectMap.put("todoId",busProcessNew.getId());
|
||||||
|
objectMap.put("list",notifyTodoSendContexts);
|
||||||
|
net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(objectMap);
|
||||||
|
oaService.setTodoDeleteMq(jsonObject.toString());
|
||||||
|
|
||||||
|
// 重新发送OA待办
|
||||||
|
object.setUserId(assignee);
|
||||||
|
oaService.sendTodoMq(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除OA待办
|
||||||
|
* @param pId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Async
|
||||||
|
public void deleteOAByPid(String pId){
|
||||||
|
CreateMQService oaService = SpringContextUtil.getBean(CreateMQService.class);
|
||||||
|
log.info("--------------------------ESP 批量发送删除待办任务----------------------------");
|
||||||
|
|
||||||
|
QueryWrapper queryWrapper1 = new QueryWrapper();
|
||||||
|
queryWrapper1.eq("P_ID",pId);
|
||||||
|
List<BusProcessNew> list = iBusProcessNewService.list(queryWrapper1);
|
||||||
|
if(!list.isEmpty()){
|
||||||
|
List<NotifyTodoSendContext> notifyTodoSendContexts = new ArrayList<>();
|
||||||
|
list.forEach(busProcessNew -> {
|
||||||
|
NotifyTodoSendContext notifyTodoSendContext = new NotifyTodoSendContext();
|
||||||
|
notifyTodoSendContext.setAppName("FOTON");
|
||||||
|
notifyTodoSendContext.setModelId(busProcessNew.getId());
|
||||||
|
notifyTodoSendContext.setModelName(busProcessNew.getTaskInfo());
|
||||||
|
notifyTodoSendContext.setType("1");
|
||||||
|
notifyTodoSendContext.setOptType("2");
|
||||||
|
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());
|
||||||
|
notifyTodoSendContext.setUserId(busProcessNew.getUserId());
|
||||||
|
notifyTodoSendContexts.add(notifyTodoSendContext);
|
||||||
|
});
|
||||||
|
Map<String,Object> map = new TreeMap<>();
|
||||||
|
map.put("todoId",pId);
|
||||||
|
map.put("list",notifyTodoSendContexts);
|
||||||
|
net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(map);
|
||||||
|
oaService.setTodoDeleteMq(jsonObject.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Async
|
||||||
|
public NotifyTodoAppDeleteResult setTodoDelete(String object) throws Exception{
|
||||||
|
Map<String,Object> objectMap = net.sf.json.JSONObject.fromObject(object);
|
||||||
|
List<NotifyTodoSendContext> notifyTodoSendContexts = JSONObject.parseArray(objectMap.get("list").toString(), NotifyTodoSendContext.class);
|
||||||
|
NotifyTodoAppDeleteResult notifyTodoAppResult = new NotifyTodoAppDeleteResult();
|
||||||
|
String result = "";
|
||||||
|
SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
JsonSend jsonSend = new JsonSend();
|
||||||
|
HEAD head = new HEAD();
|
||||||
|
head.setACCOUNT("OA");
|
||||||
|
head.setBIZTRANSACTIONID("SYC_161320210206133219");
|
||||||
|
head.setCONSUMER("FOTON");
|
||||||
|
head.setCOUNT("1");
|
||||||
|
head.setPASSWORD("TEST_oa201611241710");
|
||||||
|
head.setSRVLEVEL("1");
|
||||||
|
List<Object> list = new ArrayList<>();
|
||||||
|
list.addAll(notifyTodoSendContexts);
|
||||||
|
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_1020_SendRemoveTodo_PS",json.toString(),mapCtr);
|
||||||
|
log.info("请求发送已办接口完毕,返回响应状态:【"+sdf.format(new Date())+"】");
|
||||||
|
// JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
if(!result.contains("操作成功")){
|
||||||
|
log.error("请求发送已办接口出现异常:"+result);
|
||||||
|
notifyTodoAppResult.setSign("1");
|
||||||
|
notifyTodoAppResult.setMassage(result);
|
||||||
|
}else {
|
||||||
|
log.info("--------------------------成功发送 ESP 删除待办 "+object+"----------------------------");
|
||||||
|
log.info("okHttp请求发送已办接口成功结果:"+result);
|
||||||
|
notifyTodoAppResult = (NotifyTodoAppDeleteResult) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(result), NotifyTodoAppDeleteResult.class);
|
||||||
|
}
|
||||||
|
// try {
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error(errMes, e.getMessage());
|
||||||
|
// }
|
||||||
|
|
||||||
|
return notifyTodoAppResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Async
|
@Async
|
||||||
public void completeOA(Task task){
|
public void completeOA(Task task){
|
||||||
|
|||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package com.ydw.bat.wkflow.business_oa.webService.todoResult;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: TODO
|
||||||
|
* @author: super_liu
|
||||||
|
* @date: 2021年09月08日 15:23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class NotifyTodoAppDeleteResult {
|
||||||
|
|
||||||
|
// @ApiModelProperty(value = "返回状态 0:表示未操作 1:表示操作失败 2:表示操作成功")
|
||||||
|
@ApiModelProperty(value = "返回状态 0:表示操作成功 1:表示操作失败")
|
||||||
|
private String sign;
|
||||||
|
|
||||||
|
// @ApiModelProperty(value = "返回信息 " +
|
||||||
|
// "返回状态值为0时,该值返回空 " +
|
||||||
|
// "返回状态值为1时,该值错误信息 " +
|
||||||
|
// "返回状态值为2时,该值返回空")
|
||||||
|
@ApiModelProperty(value = "返回信息 " +
|
||||||
|
"返回状态值为0时,表示操作成功 " +
|
||||||
|
"返回状态值为1时,该值错误信息 ")
|
||||||
|
private String massage;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user