map = oaTaskExecService.execTask(todoId);
+ return map;
+ }
+
+}
+
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/controller/SendTodoLogController.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/controller/SendTodoLogController.java
new file mode 100644
index 00000000..2fed7a97
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/controller/SendTodoLogController.java
@@ -0,0 +1,21 @@
+package com.ydw.bat.wkflow.business_main.datas.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ *
+ * OA日志表 前端控制器
+ *
+ *
+ * @author super_liu
+ * @since 2021-09-17
+ */
+@RestController
+@RequestMapping("/sendTodoLog")
+public class SendTodoLogController {
+
+}
+
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/BusProcessNew.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/BusProcessNew.java
index b9470655..134d9db7 100644
--- a/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/BusProcessNew.java
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/BusProcessNew.java
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -88,4 +90,21 @@ public class BusProcessNew implements Serializable {
@ApiModelProperty(value = "流程名称")
@TableField("PRC_NAME")
private String prcName;
+
+ @TableField( exist = false)
+ @ApiModelProperty(value = "OA link")
+ private String link;
+
+ @TableField( exist = false)
+ @ApiModelProperty(value = "干活任务截止时间")
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+ private String endTime;
+
+ @TableField( exist = false)
+ @ApiModelProperty(value = "任务状态 0 默认 1 审批任务 2 干活任务")
+ private int taskStatus;
+
+ @TableField( exist = false)
+ @ApiModelProperty(value = "提交状态 0 提交 其它 接受 ")
+ private long commitStatus;
}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/OaTaskExec.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/OaTaskExec.java
new file mode 100644
index 00000000..d0d3ac29
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/OaTaskExec.java
@@ -0,0 +1,86 @@
+package com.ydw.bat.wkflow.business_main.datas.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ *
+ * OA 干活任务执行表
+ *
+ *
+ * @author Super_liu
+ * @since 2021-09-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="OaTaskExec对象", description="OA 干活任务执行表")
+public class OaTaskExec implements Serializable {
+
+ private static final long serialVersionUID=1L;
+
+ @ApiModelProperty(value = "主键")
+ @TableId(value = "ID", type = IdType.UUID)
+ private String id;
+
+ @ApiModelProperty(value = "执行维度 1 3天内 2 3天外 3 超时")
+ @TableField("EXEC_TYPE")
+ private int execType;
+
+ @ApiModelProperty(value = "待办ID")
+ @TableField("TODO_ID")
+ private String todoId;
+
+ @ApiModelProperty(value = "待办用户ID")
+ @TableField("USER_ID")
+ private String userId;
+
+ @ApiModelProperty(value = "待办对象JSON")
+ @TableField("MESG")
+ private String mesg;
+
+ @ApiModelProperty(value = "执行状态 0 未启动 1 已启动 2 已完成")
+ @TableField("EXEC_STATUS")
+ private int execStatus;
+
+ @ApiModelProperty(value = "执行时间")
+ @TableField("EXEC_TIME")
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+ private String execTime;
+
+ @ApiModelProperty(value = "截止时间")
+ @TableField("END_TIME")
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+ private String endTime;
+
+ @ApiModelProperty(value = "创建时间")
+ @TableField("CREATE_TIME")
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+ private String createTime;
+
+ @ApiModelProperty(value = "更新时间")
+ @TableField("UPDATE_TIME")
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+ private String updateTime;
+
+ @ApiModelProperty(value = "参数1")
+ @TableField("PARAM1")
+ private int param1;
+
+ @ApiModelProperty(value = "参数2")
+ @TableField("PARAM2")
+ private String param2;
+
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/SendTodoLog.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/SendTodoLog.java
new file mode 100644
index 00000000..0cdb1b53
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/entity/SendTodoLog.java
@@ -0,0 +1,88 @@
+package com.ydw.bat.wkflow.business_main.datas.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ *
+ * OA日志表
+ *
+ *
+ * @author super_liu
+ * @since 2021-09-17
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="SendTodoLog对象", description="OA日志表")
+public class SendTodoLog implements Serializable {
+
+ private static final long serialVersionUID=1L;
+
+ @ApiModelProperty(value = "主键")
+ @TableId(value = "ID", type = IdType.UUID)
+ private String id;
+
+ @ApiModelProperty(value = "类型 0 待办, 1已办, 2 取消, 3 删除")
+ @TableField("MSG_TYPE")
+ private String msgType;
+
+ @ApiModelProperty(value = "待办ID")
+ @TableField("TODO_ID")
+ private String todoId;
+
+ @ApiModelProperty(value = "待办用户ID")
+ @TableField("USER_ID")
+ private String userId;
+
+ @ApiModelProperty(value = "邮箱用户ID")
+ @TableField("EMAIL_USER_ID")
+ private String emailUserId;
+
+ @ApiModelProperty(value = "待办对象JSON")
+ @TableField("MESG")
+ private String mesg;
+
+ @ApiModelProperty(value = "状态 1 待发送 2 成功 3 失败 4 无需发送")
+ @TableField("MSG_STATUS")
+ private String msgStatus;
+
+ @ApiModelProperty(value = "失败次数")
+ @TableField("ERR_NUM")
+ private int errNum;
+
+ @ApiModelProperty(value = "操作信息")
+ @TableField("OPER_MESG")
+ private String operMesg;
+
+ @ApiModelProperty(value = "创建时间")
+ @TableField("CREATE_TIME")
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+ private String createTime;
+
+ @ApiModelProperty(value = "更新时间")
+ @TableField("UPDATE_TIME")
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+ private String updateTime;
+
+ @ApiModelProperty(value = "参数1")
+ @TableField("PARAM1")
+ private String param1;
+
+ @ApiModelProperty(value = "参数2")
+ @TableField("PARAM2")
+ private String param2;
+
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/mapper/OaTaskExecMapper.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/mapper/OaTaskExecMapper.java
new file mode 100644
index 00000000..10f7b6e4
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/mapper/OaTaskExecMapper.java
@@ -0,0 +1,16 @@
+package com.ydw.bat.wkflow.business_main.datas.mapper;
+
+import com.ydw.bat.wkflow.business_main.datas.entity.OaTaskExec;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * OA 干活任务执行表 Mapper 接口
+ *
+ *
+ * @author Super_liu
+ * @since 2021-09-24
+ */
+public interface OaTaskExecMapper extends BaseMapper {
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/mapper/SendTodoLogMapper.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/mapper/SendTodoLogMapper.java
new file mode 100644
index 00000000..fb6d03b2
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/mapper/SendTodoLogMapper.java
@@ -0,0 +1,18 @@
+package com.ydw.bat.wkflow.business_main.datas.mapper;
+
+import com.ydw.bat.wkflow.business_main.datas.entity.SendTodoLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ *
+ * OA日志表 Mapper 接口
+ *
+ *
+ * @author super_liu
+ * @since 2021-09-17
+ */
+@Repository
+public interface SendTodoLogMapper extends BaseMapper {
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/IOaTaskExecService.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/IOaTaskExecService.java
new file mode 100644
index 00000000..1e22b933
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/IOaTaskExecService.java
@@ -0,0 +1,20 @@
+package com.ydw.bat.wkflow.business_main.datas.service;
+
+import com.ydw.bat.wkflow.business_main.datas.entity.OaTaskExec;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Map;
+
+/**
+ *
+ * OA 干活任务执行表 服务类
+ *
+ *
+ * @author Super_liu
+ * @since 2021-09-24
+ */
+public interface IOaTaskExecService extends IService {
+
+ Map execTask(String todoId);
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/ISendTodoLogService.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/ISendTodoLogService.java
new file mode 100644
index 00000000..46c0fed2
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/ISendTodoLogService.java
@@ -0,0 +1,16 @@
+package com.ydw.bat.wkflow.business_main.datas.service;
+
+import com.ydw.bat.wkflow.business_main.datas.entity.SendTodoLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * OA日志表 服务类
+ *
+ *
+ * @author super_liu
+ * @since 2021-09-17
+ */
+public interface ISendTodoLogService extends IService {
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/impl/OaTaskExecServiceImpl.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/impl/OaTaskExecServiceImpl.java
new file mode 100644
index 00000000..f0ffc21f
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/impl/OaTaskExecServiceImpl.java
@@ -0,0 +1,90 @@
+package com.ydw.bat.wkflow.business_main.datas.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ydw.bat.wkflow.business_main.datas.entity.BusProcessNew;
+import com.ydw.bat.wkflow.business_main.datas.entity.OaTaskExec;
+import com.ydw.bat.wkflow.business_main.datas.mapper.OaTaskExecMapper;
+import com.ydw.bat.wkflow.business_main.datas.service.IOaTaskExecService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydw.bat.wkflow.business_mq.service.CreateMQService;
+import com.ydw.bat.wkflow.util.Utils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ *
+ * OA 干活任务执行表 服务实现类
+ *
+ *
+ * @author Super_liu
+ * @since 2021-09-24
+ */
+@Service
+public class OaTaskExecServiceImpl extends ServiceImpl implements IOaTaskExecService {
+
+ @Autowired
+ private IOaTaskExecService oaTaskExecService;
+
+ @Autowired
+ private CreateMQService oaService;
+
+ @Override
+ public Map execTask(String todoId){
+ Map map = new TreeMap<>();
+ QueryWrapper wrapper = new QueryWrapper();
+ wrapper.eq("TODO_ID",todoId);
+ wrapper.eq("EXEC_TYPE",2);
+ List taskExecs = oaTaskExecService.list(wrapper);
+ if(!taskExecs.isEmpty()){
+ OaTaskExec oaTaskExec = taskExecs.get(0);
+ BusProcessNew object = (BusProcessNew) net.sf.json.JSONObject.toBean(net.sf.json.JSONObject.fromObject(oaTaskExec.getMesg()), BusProcessNew.class);
+ int days = Utils.subDayNum(oaTaskExec.getEndTime());
+ if(days > 3){
+ // 3天外处理 更改执行状态 1 进入定时任务 不发送OA待办
+ updateOaTaskExec(taskExecs,1,2);
+ getSuccess(map, "0", "操作成功");
+ }else {
+ if(days < 0){
+ // 超时处理
+ updateOaTaskExec(taskExecs,0,3);
+ // 直接发送OA待办 重置任务状态 0
+ object.setTaskStatus(0);
+ oaService.sendTodoMq(object);
+ getSuccess(map, "0", "操作成功");
+ }else {
+ // 3天内处理
+ updateOaTaskExec(taskExecs,0,1);
+ // 直接发送OA待办 重置任务状态 0
+ object.setTaskStatus(0);
+ oaService.sendTodoMq(object);
+ getSuccess(map, "0", "操作成功");
+ }
+ }
+
+ }
+ return map;
+ }
+
+ private void getSuccess(Map map, String sign, String message) {
+ map.put("sign",sign);
+ map.put("message",message);
+ }
+
+ private void updateOaTaskExec(List taskExecs, int execStatus, int execType){
+ List updateList = new ArrayList<>();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+ updateList.addAll(taskExecs);
+ updateList.forEach(taskExec -> {
+ // 任务修改为 启动状态
+ taskExec.setExecStatus(execStatus);
+ taskExec.setExecType(execType);
+ taskExec.setUpdateTime(sdf.format(new Date()));
+ });
+ oaTaskExecService.updateBatchById(updateList);
+ }
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/impl/SendTodoLogServiceImpl.java b/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/impl/SendTodoLogServiceImpl.java
new file mode 100644
index 00000000..2e01d0ae
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_main/datas/service/impl/SendTodoLogServiceImpl.java
@@ -0,0 +1,24 @@
+package com.ydw.bat.wkflow.business_main.datas.service.impl;
+
+import com.ydw.bat.wkflow.business_main.datas.entity.SendTodoLog;
+import com.ydw.bat.wkflow.business_main.datas.mapper.SendTodoLogMapper;
+import com.ydw.bat.wkflow.business_main.datas.service.ISendTodoLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * OA日志表 服务实现类
+ *
+ *
+ * @author super_liu
+ * @since 2021-09-17
+ */
+@Service
+public class SendTodoLogServiceImpl extends ServiceImpl implements ISendTodoLogService {
+
+ @Autowired
+ private SendTodoLogMapper sendTodoLogMapper;
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_mq/service/CreateMQService.java b/src/main/java/com/ydw/bat/wkflow/business_mq/service/CreateMQService.java
new file mode 100644
index 00000000..f5df0403
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_mq/service/CreateMQService.java
@@ -0,0 +1,48 @@
+package com.ydw.bat.wkflow.business_mq.service;
+
+import com.ydw.bat.wkflow.business_main.datas.entity.BusProcessNew;
+import com.ydw.bat.wkflow.business_oa.webService.todoContent.NotifyTodoSendContext;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.amqp.core.AmqpTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Component
+public class CreateMQService {
+ @Autowired
+ private AmqpTemplate rabbitTemplate;
+
+ @Value("${oa.flag}")
+ private Boolean oaFlag;
+
+ /**
+ * @author: super_liu
+ * @date: 2021年09月17日 14:40
+ **/
+ public void setTodoDoneMq(NotifyTodoSendContext object){
+
+ if(oaFlag){
+ //发送消息队列
+ this.rabbitTemplate.convertAndSend("sendDone-exchange_MQ_GSAR", "sendDone-key_MQ_GSAR", object);
+
+ }
+ }
+
+ /**
+ * @author: super_liu
+ * @date: 2021年09月17日 14:40
+ **/
+ public void sendTodoMq(BusProcessNew object){
+
+ if(oaFlag) {
+ //发送消息队列
+ this.rabbitTemplate.convertAndSend("send-exchange_MQ_GSAR", "send-key_MQ_GSAR", object);
+ }
+ }
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendDoneMQService.java b/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendDoneMQService.java
new file mode 100644
index 00000000..aa16152b
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendDoneMQService.java
@@ -0,0 +1,179 @@
+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_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.NotifyTodoAppResult;
+import net.sf.json.JSONObject;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+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;
+
+@Component
+public class SendDoneMQService {
+
+ private static final Logger logger = LoggerFactory.getLogger(SendDoneMQService.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 = "createMQDone_SQ_GSAR", durable = "true"),
+ exchange = @Exchange(value = "sendDone-exchange_MQ_GSAR", ignoreDeclarationExceptions = "true"),
+ key = "sendDone-key_MQ_GSAR"))
+ public void createMQDone(NotifyTodoSendContext 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(NotifyTodoSendContext object) throws Exception {
+ try {
+ NotifyTodoAppResult todoAppResult = webServiceOAService.setTodoDone(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",object.getModelId());
+ wrapper.eq("MSG_TYPE","1");
+ List list = sendTodoLogMapper.selectList(wrapper);
+ if(!list.isEmpty()) {
+ SendTodoLog sendTodoLog = list.get(0);
+ sendTodoLog.setOperMesg(todoAppResult.getMASSAGE());
+ sendTodoLog.setMsgStatus("2");
+ sendTodoLog.setCreateTime(sdf.format(new Date()));
+ sendTodoLog.setUpdateTime(sdf.format(new Date()));
+ sendTodoLogMapper.updateById(sendTodoLog);
+ }else {
+ sendTodoSave(object, sdf, "2",todoAppResult.getMASSAGE());
+ }
+ }else {
+ logger.error("ESP 发送待办任务异常 :" + "SIGN: "+todoAppResult.getSIGN()+",MASSAGE: "+todoAppResult.getMASSAGE());
+ // 重试发送待办
+ logger.info("重试发送待办");
+ this.restartSendMq(object,todoAppResult.getMASSAGE());
+ }
+ }catch (Exception e){
+ logger.error(e.getMessage(),e);
+ this.restartSendMq(object, e.getMessage());
+ }
+ }
+
+ public void restartSendMq(NotifyTodoSendContext object,String operMesg) throws Exception{
+ QueryWrapper wrapper = new QueryWrapper();
+ wrapper.eq("TODO_ID",object.getModelId());
+ wrapper.eq("MSG_TYPE","1");
+ List 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 emailList = new ArrayList<>();
+ ResponseMessage 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 = "" +
+ "
"+"OA请求发送失败6次,请线下协调处理"+" ";
+ emailUtils.sendMsgFeign(arr,title,countText);
+
+ }else {
+ restSendDoneTodo(object, sdf, sendTodoLog, againNumNew,operMesg);
+ }
+
+ }else {
+ sendTodoSave(object, sdf, "3",operMesg);
+ }
+ }
+
+ private void restSendDoneTodo(NotifyTodoSendContext 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.setTodoDoneMq(object);
+ logger.info("已重新加入延迟队列");
+ }
+
+ private void sendTodoSave(NotifyTodoSendContext object, SimpleDateFormat sdf, String s,String operMesg) {
+ SendTodoLog sendTodoLog = new SendTodoLog();
+ sendTodoLog.setMsgType("1");
+ JSONObject json = JSONObject.fromObject(object);
+ sendTodoLog.setTodoId(object.getModelId());
+ sendTodoLog.setMesg(json.toString());
+ sendTodoLog.setMsgStatus(s);
+ sendTodoLog.setErrNum(1);
+ sendTodoLog.setOperMesg(operMesg);
+ sendTodoLog.setCreateTime(sdf.format(new Date()));
+ sendTodoLog.setUpdateTime(sdf.format(new Date()));
+ sendTodoLog.setUserId(object.getUserId());
+ sendTodoLogMapper.insert(sendTodoLog);
+ if(s.equals("2")){
+ logger.info("发送成功,存入OA日志");
+ }else{
+ convertMq.setTodoDoneMq(object);
+ logger.info("已重新加入延迟队列");
+ }
+
+ }
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendMQService.java b/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendMQService.java
new file mode 100644
index 00000000..46eaff1b
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_mq/service/SendMQService.java
@@ -0,0 +1,212 @@
+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.*;
+import com.ydw.bat.wkflow.business_main.datas.mapper.SendTodoLogMapper;
+import com.ydw.bat.wkflow.business_main.datas.service.IOaTaskExecService;
+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.todoResult.NotifyTodoAppResult;
+import com.ydw.bat.wkflow.util.Utils;
+import net.sf.json.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+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.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Component
+public class SendMQService {
+
+ private static final Logger logger = LoggerFactory.getLogger(SendMQService.class);
+
+ @Autowired
+ private CreateMQService convertMq;
+
+ @Autowired
+ private EmailUtils emailUtils;
+
+ @Autowired
+ private WebServiceOAService webServiceOAService;
+
+ @Autowired
+ private SendTodoLogMapper sendTodoLogMapper;
+
+ @Autowired
+ private IOaTaskExecService oaTaskExecService;
+
+ @Autowired
+ private LawsUserInfoService lawsUserInfoService;
+
+ @RabbitListener(bindings = @QueueBinding(
+ value = @Queue(value = "createMQ_SQ_GSAR", durable = "true"),
+ exchange = @Exchange(value = "send-exchange_MQ_GSAR", ignoreDeclarationExceptions = "true"),
+ key = "send-key_MQ_GSAR"))
+ public void createMQ(BusProcessNew object, Message message, Channel channel) throws Exception{
+ try{
+ try{
+ Thread.sleep(5000);
+ if(object.getTaskStatus() == 2 && object.getEndTime() != null && StringUtils.isNotBlank(object.getEndTime())){
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ int days = Utils.subDayNum(object.getEndTime());
+ // 3 天 外
+ if(days > 3){
+ // 执行日期
+ String execTime = Utils.subDay(object.getEndTime(),3);
+ net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(object);
+
+ // 执行任务对象 默认存储
+ OaTaskExec oaTaskExec = new OaTaskExec();
+ oaTaskExec.setExecType(2);
+ oaTaskExec.setTodoId(object.getId());
+ oaTaskExec.setUserId(object.getUserId());
+ oaTaskExec.setMesg(json.toString());
+ oaTaskExec.setCreateTime(sdf.format(new Date()));
+ oaTaskExec.setUpdateTime(sdf.format(new Date()));
+ oaTaskExec.setExecTime(execTime);
+ oaTaskExec.setEndTime(object.getEndTime());
+ oaTaskExec.setExecStatus(0);
+ oaTaskExecService.save(oaTaskExec);
+ object.setPrcName(object.getPrcName()+",请接受任务!");
+
+ // 3 天 外 发送 OA 接受待办
+ insertOrUpdateInfo(object);
+ }else {
+ // 3 天 内 发送 OA 待办
+ insertOrUpdateInfo(object);
+ }
+ }else {
+ // 正常逻辑发送 OA 待办
+ 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(BusProcessNew object) throws Exception {
+ try {
+ NotifyTodoAppResult todoAppResult = webServiceOAService.sendTodo(object);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
+
+ if(todoAppResult.getSIGN().equals("0") || todoAppResult.getMASSAGE().equals("操作成功")){
+ QueryWrapper wrapper = new QueryWrapper();
+ wrapper.eq("TODO_ID",object.getId());
+ wrapper.eq("MSG_TYPE","0");
+ List list = sendTodoLogMapper.selectList(wrapper);
+ if(!list.isEmpty()) {
+ SendTodoLog sendTodoLog = list.get(0);
+ sendTodoLog.setMsgStatus("2");
+ sendTodoLog.setOperMesg(todoAppResult.getMASSAGE());
+ sendTodoLog.setCreateTime(sdf.format(new Date()));
+ sendTodoLog.setUpdateTime(sdf.format(new Date()));
+ sendTodoLogMapper.updateById(sendTodoLog);
+ }else {
+ sendTodoSave(object, sdf, "2",todoAppResult.getMASSAGE());
+ }
+ }else {
+ // 重试发送待办
+ logger.info("重试发送待办");
+ this.restartSendMq(object,todoAppResult.getMASSAGE());
+ }
+
+ }catch (Exception e){
+ logger.error(e.getMessage(),e);
+ this.restartSendMq(object, e.getMessage());
+ }
+ }
+
+ public void restartSendMq(BusProcessNew object,String operMesg) throws Exception{
+ QueryWrapper wrapper = new QueryWrapper();
+ wrapper.eq("TODO_ID",object.getId());
+ wrapper.eq("MSG_TYPE","0");
+ List 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){
+ ResponseMessage byId = lawsUserInfoService.getById("WY8J26MH23");
+ // 发送待办 或 发送给管理员邮箱
+ List emailList = new ArrayList<>();
+ // 占时指定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 = "" +
+ "
"+"OA请求发送失败6次,请线下协调处理"+" ";
+ emailUtils.sendMsgFeign(arr,title,countText);
+ logger.info("发送失败6次,发送给管理员邮箱");
+ }else {
+ restSendTodo(object, sdf, sendTodoLog, againNumNew,operMesg);
+ }
+ }else {
+ sendTodoSave(object, sdf, "3",operMesg);
+ }
+ }
+
+ private void restSendTodo(BusProcessNew object, SimpleDateFormat sdf, SendTodoLog sendTodoLog, int againNumNew,String operMesg) throws Exception{
+ // 失败次数小于6次,放入失败队列延迟消费
+ 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.sendTodoMq(object);
+ logger.info("已重新加入延迟队列");
+ }
+
+ private void sendTodoSave(BusProcessNew object, SimpleDateFormat sdf, String s,String operMesg) {
+ SendTodoLog sendTodoLog = new SendTodoLog();
+ sendTodoLog.setMsgType("0");
+ sendTodoLog.setTodoId(object.getId());
+ sendTodoLog.setUserId(object.getUserId());
+ JSONObject json = JSONObject.fromObject(object);
+ sendTodoLog.setMesg(json.toString());
+ 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.sendTodoMq(object);
+ logger.info("已重新加入延迟队列");
+ }
+ }
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/common/WebServiceConf.java b/src/main/java/com/ydw/bat/wkflow/business_oa/common/WebServiceConf.java
new file mode 100644
index 00000000..a3f179e8
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_oa/common/WebServiceConf.java
@@ -0,0 +1,66 @@
+package com.ydw.bat.wkflow.business_oa.common;
+
+import com.ydw.bat.wkflow.business_oa.exception.CommonException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+import org.springframework.stereotype.Service;
+
+import java.util.ResourceBundle;
+
+/**
+ * @Description: TODO
+ * @author: super_liu
+ * @date: 2021年09月08日 14:40
+ */
+
+@Service
+public class WebServiceConf {
+
+ /**
+ * 调用webservice 接口
+ *
+ * @param method 调用方法名
+ * @param params 接口传入参数
+ * @return
+ */
+ public static synchronized Object[] invoke(String wsdlUrl, String method, Object[] params) throws Exception {
+ Object[] objectArr = null;
+ //创建动态客户端
+ JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory
+ .newInstance();
+ Client client = dcf.createClient(wsdlUrl);
+ try {
+ //如果返回的address不是远程服务地址,重新制定地址
+ //添加发送请求拦截器
+ if (StringUtils.isEmpty(method)) {
+ throw new CommonException("cxf 调用webservice 执行方法名缺失:method 未传入");
+ }
+
+
+ // cxf 调用webservice method paramsStr
+ HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); // 策略
+ httpClientPolicy.setConnectionTimeout(36000); //连接超时
+ httpClientPolicy.setAllowChunking(false);
+ httpClientPolicy.setReceiveTimeout(10000); //接收超时
+ HTTPConduit http = (HTTPConduit) client.getConduit();
+ http.setClient(httpClientPolicy);
+
+
+ objectArr = client.invoke(method, params);
+
+ } catch (Exception e) {
+ throw new CommonException("cxf 调用webservice 执行错误:" + e.toString());
+ }finally {
+ client.close();
+ }
+
+ return objectArr;
+ }
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/config/OkHttpConfig.java b/src/main/java/com/ydw/bat/wkflow/business_oa/config/OkHttpConfig.java
new file mode 100644
index 00000000..cd3db618
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_oa/config/OkHttpConfig.java
@@ -0,0 +1,69 @@
+package com.ydw.bat.wkflow.business_oa.config;
+
+import okhttp3.ConnectionPool;
+import okhttp3.OkHttpClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.concurrent.TimeUnit;
+
+@Configuration
+public class OkHttpConfig {
+
+ @Bean
+ public X509TrustManager x509TrustManager() {
+ return new X509TrustManager() {
+ @Override
+ public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
+ }
+ @Override
+ public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
+ }
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[0];
+ }
+ };
+ }
+ @Bean
+ public SSLSocketFactory sslSocketFactory() {
+ try {
+ //信任任何链接
+ SSLContext sslContext = SSLContext.getInstance("TLS");
+ sslContext.init(null, new TrustManager[]{x509TrustManager()}, new SecureRandom());
+ return sslContext.getSocketFactory();
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (KeyManagementException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ /**
+ * Create a new connection pool with tuning parameters appropriate for a single-user application.
+ * The tuning parameters in this pool are subject to change in future OkHttp releases. Currently
+ */
+ @Bean
+ public ConnectionPool pool() {
+ return new ConnectionPool(200, 5, TimeUnit.MINUTES);
+ }
+ @Bean
+ public OkHttpClient okHttpClient() {
+ return new OkHttpClient.Builder()
+ .sslSocketFactory(sslSocketFactory(), x509TrustManager())
+ .retryOnConnectionFailure(false)//是否开启缓存
+ .connectionPool(pool())//连接池
+ .connectTimeout(10L, TimeUnit.SECONDS)
+ .readTimeout(10L, TimeUnit.SECONDS)
+ .build();
+ }
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/exception/CommonException.java b/src/main/java/com/ydw/bat/wkflow/business_oa/exception/CommonException.java
new file mode 100644
index 00000000..f159a030
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_oa/exception/CommonException.java
@@ -0,0 +1,12 @@
+package com.ydw.bat.wkflow.business_oa.exception;
+
+/**
+ * 自定义简单异常
+ *
+ */
+public class CommonException extends RuntimeException {
+
+ public CommonException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/utils/EmailUtils.java b/src/main/java/com/ydw/bat/wkflow/business_oa/utils/EmailUtils.java
new file mode 100644
index 00000000..f14be1d7
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_oa/utils/EmailUtils.java
@@ -0,0 +1,342 @@
+package com.ydw.bat.wkflow.business_oa.utils;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.mail.MailException;
+import org.springframework.mail.SimpleMailMessage;
+import org.springframework.mail.javamail.JavaMailSenderImpl;
+import org.springframework.mail.javamail.MimeMessageHelper;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeMessage;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+
+@Component
+public class EmailUtils {
+
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+ /**
+ * The Mail sender.
+ */
+ @Autowired
+ JavaMailSenderImpl mailSender;
+
+ @Value("${mail.valid}")
+ private boolean mailValid;
+
+ @Value("${spring.mail.username}")
+ private String userName;
+
+ @Value("${spring.mail.password}")
+ private String mailPwd;
+
+ /**
+ * Send simple email.
+ *
+ * @param deliver the deliver
+ * @param receiver the receiver
+ * @param subject the subject
+ * @param content the content
+ * @throws ServiceException the service exception
+ */
+ public void sendSimpleEmail(String deliver,String personName, String receiver, String subject, String content) throws ServiceException {
+ if(mailValid){
+ String[] receivers = {receiver};
+ sendSimpleEmail(deliver,personName, receivers, null, subject, content);
+ }
+ }
+
+
+
+ /**
+ * Send simple email.
+ *
+ * @param deliver the deliver
+ * @param receiver the receiver
+ * @param carbonCopy the carbon copy
+ * @param subject the subject
+ * @param content the content
+ * @throws ServiceException the service exception
+ */
+ public void sendSimpleEmail(String deliver,String personName, String[] receiver, String[] carbonCopy, String subject, String content) throws ServiceException {
+
+ long startTimestamp = System.currentTimeMillis();
+ logger.info("Start send mail ... ");
+
+ try {
+ SimpleMailMessage message = new SimpleMailMessage();
+ personName=javax.mail.internet.MimeUtility.encodeText(personName);
+ message.setFrom(personName + "<"+deliver+">");
+ message.setTo(receiver);
+ if(carbonCopy!=null && carbonCopy.length>0){
+ message.setCc(carbonCopy);
+ }
+ message.setSubject(subject);
+ message.setText(content);
+ if(StringUtils.isBlank(mailPwd)){
+ mailSender.setPassword(null);
+ }
+ mailSender.send(message);
+ logger.info("Send mail success, cost {} million seconds", System.currentTimeMillis() - startTimestamp);
+ } catch (MailException e) {
+ logger.error("Send mail failed, error message is : {} \n", e.getMessage());
+ logger.error(e.getMessage(),e);
+ throw new ServiceException(e.getMessage());
+ } catch (UnsupportedEncodingException e) {
+ logger.error("Send mail failed, error message is : {} \n", e.getMessage());
+ logger.error(e.getMessage(),e);
+ throw new ServiceException(e.getMessage());
+ }
+ }
+
+
+
+ /**
+ * Send html email.
+ *
+ * @param deliver the deliver
+ * @param receiver the receiver
+ * @param subject the subject
+ * @param content the content
+ * @throws ServiceException the service exception
+ */
+ public void sendHtmlEmail(String deliver, String receiver, String subject, String content) throws ServiceException {
+ String[] receivers = {receiver};
+ sendHtmlEmail(deliver, receivers, null, subject, content, true);
+ }
+
+ /**
+ * Send html email.
+ *
+ * @param deliver the deliver
+ * @param receiver the receiver
+ * @param carbonCopy the carbon copy
+ * @param subject the subject
+ * @param content the content
+ * @param isHtml the is html
+ * @throws ServiceException the service exception
+ */
+ public void sendHtmlEmail(String deliver, String[] receiver, String[] carbonCopy, String subject, String content, boolean isHtml) throws ServiceException {
+ long startTimestamp = System.currentTimeMillis();
+ logger.info("Start send email ...");
+
+ try {
+ MimeMessage message = mailSender.createMimeMessage();
+ MimeMessageHelper messageHelper = new MimeMessageHelper(message);
+
+ messageHelper.setFrom(deliver);
+ messageHelper.setTo(receiver);
+ if (null != carbonCopy) {
+ messageHelper.setCc(carbonCopy);
+ }
+ messageHelper.setSubject(subject);
+ messageHelper.setText(content, isHtml);
+ if(StringUtils.isBlank(mailPwd)){
+ mailSender.setPassword(null);
+ }
+ mailSender.send(message);
+ logger.info("Send email success, cost {} million seconds", System.currentTimeMillis() - startTimestamp);
+ } catch (MessagingException e) {
+ logger.error("Send email failed, error message is {} \n", e.getMessage());
+ logger.error(e.getMessage(),e);
+ throw new ServiceException(e.getMessage());
+ }
+ }
+
+ /**
+ * Send attachment file email.
+ *
+ * @param deliver the deliver
+ * @param receiver the receiver
+ * @param subject the subject
+ * @param content the content
+ * @param fileName the file name
+ * @param file the file
+ * @throws ServiceException the service exception
+ */
+ public void sendAttachmentFileEmail(String deliver, String receiver, String subject, String content, String fileName, File file) throws ServiceException {
+ String[] receivers = {receiver};
+ sendAttachmentFileEmail(deliver, receivers, null, subject, content, true, fileName, file);
+ }
+
+ /**
+ * Send attachment file mail.
+ *
+ * @param deliver the deliver
+ * @param receiver the receiver
+ * @param carbonCopy the carbon copy
+ * @param subject the subject
+ * @param content the content
+ * @param isHtml the is html
+ * @param fileName the file name
+ * @param file the file
+ * @throws ServiceException the service exception
+ */
+ public void sendAttachmentFileEmail(String deliver, String[] receiver, String[] carbonCopy, String subject, String content, boolean isHtml, String fileName, File file) throws ServiceException {
+ long startTimestamp = System.currentTimeMillis();
+ logger.info("Start send mail ...");
+
+ try {
+ MimeMessage message = mailSender.createMimeMessage();
+ MimeMessageHelper messageHelper = new MimeMessageHelper(message, true);
+
+ messageHelper.setFrom(deliver);
+ messageHelper.setTo(receiver);
+ messageHelper.setCc(carbonCopy);
+ messageHelper.setSubject(subject);
+ messageHelper.setText(content, isHtml);
+ messageHelper.addAttachment(fileName, file);
+ if(StringUtils.isBlank(mailPwd)){
+ mailSender.setPassword(null);
+ }
+ mailSender.send(message);
+ logger.info("Send mail success, cost {} million seconds", System.currentTimeMillis() - startTimestamp);
+ } catch (MessagingException e) {
+ logger.error("Send mail failed, error message is {}\n", e.getMessage());
+ logger.error(e.getMessage(),e);
+ throw new ServiceException(e.getMessage());
+ }
+ }
+
+ /* *//**
+ * Send template email.
+ *
+ * @param deliver the deliver
+ * @param receiver the receiver
+ * @param subject the subject
+ * @param template the template
+ * @param context the context
+ * @throws ServiceException the service exception
+ *//*
+ public void sendTemplateEmail(String deliver, String receiver, String subject, String template, Context context) throws ServiceException {
+ String[] receivers = {receiver};
+ sendTemplateEmail(deliver, receivers, null, subject, template, context);
+ }*/
+
+ /* *//**
+ * Send template mail.
+ * @throws ServiceException the service exception
+ *//*
+ public void sendTemplateEmail(String deliver, String[] receiver, String[] carbonCopy, String subject, String template, Context context) throws ServiceException {
+ long startTimestamp = System.currentTimeMillis();
+ logger.info("Start send mail ...");
+
+ try {
+ MimeMessage message = mailSender.createMimeMessage();
+ MimeMessageHelper messageHelper = new MimeMessageHelper(message);
+
+ String content = templateEngine.process(template, context);
+ messageHelper.setFrom(deliver);
+ messageHelper.setTo(receiver);
+ messageHelper.setCc(carbonCopy);
+ messageHelper.setSubject(subject);
+ messageHelper.setText(content, true);
+
+ mailSender.send(message);
+ logger.info("Send mail success, cost {} million seconds", System.currentTimeMillis() - startTimestamp);
+ } catch (MessagingException e) {
+ logger.error("Send mail failed, error message is {} \n", e.getMessage());
+ e.printStackTrace();
+ throw new ServiceException(e.getMessage());
+ }
+ }*/
+
+ @Async
+ public void sendMsg(String[] tos,String msg){
+ //创建简单邮件消息
+ SimpleMailMessage message = new SimpleMailMessage();
+ //谁发的
+ message.setFrom(userName);
+ //谁要接收
+ message.setTo(tos);
+ //邮件标题
+ message.setSubject(msg);
+ //邮件内容
+ message.setText(msg);
+ try {
+ if(StringUtils.isBlank(mailPwd)){
+ mailSender.setPassword(null);
+ }
+ mailSender.send(message);
+ } catch (MailException e) {
+ logger.error(e.getMessage(),e);
+ }
+ }
+
+ @Async
+ public void sendMsgNew(String[] tos,String msg,String title){
+ //创建简单邮件消息
+ SimpleMailMessage message = new SimpleMailMessage();
+ //谁发的
+ message.setFrom(userName);
+ //谁要接收
+ message.setTo(tos);
+ //邮件标题
+ message.setSubject(title);
+ //邮件内容
+ message.setText(msg);
+ try {
+ if(StringUtils.isBlank(mailPwd)){
+ mailSender.setPassword(null);
+ }
+ mailSender.send(message);
+ } catch (MailException e) {
+ logger.error(e.getMessage(),e);
+ }
+ }
+
+ @Async
+ public void sendMsgFeign(String[] tos,String title, String msg){
+ //创建简单邮件消息
+ SimpleMailMessage message = new SimpleMailMessage();
+ //谁发的
+ message.setFrom(userName);
+ //谁要接收
+ message.setTo(tos);
+ //邮件标题
+ message.setSubject(title);
+ //邮件内容
+ message.setText(msg);
+ try {
+ if (null != tos){
+ for (String to :tos){
+ sendHtmlEmail( userName, to, title, msg);
+ }
+ }
+
+ } catch (ServiceException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Async
+ public void sendMsgWithCC(String[] tos,String[] cc,String msg){
+ //创建简单邮件消息
+ SimpleMailMessage message = new SimpleMailMessage();
+ //谁发的
+ message.setFrom(userName);
+ //谁要接收
+ message.setTo(tos);
+ //抄送
+ message.setCc(cc);
+ //邮件标题
+ message.setSubject(msg);
+ //邮件内容
+ message.setText(msg);
+ try {
+ if(StringUtils.isBlank(mailPwd)){
+ mailSender.setPassword(null);
+ }
+ mailSender.send(message);
+ } catch (MailException e) {
+ logger.error(e.getMessage(),e);
+ }
+ }
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/utils/OkHttpUtil.java b/src/main/java/com/ydw/bat/wkflow/business_oa/utils/OkHttpUtil.java
new file mode 100644
index 00000000..3789a964
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_oa/utils/OkHttpUtil.java
@@ -0,0 +1,323 @@
+package com.ydw.bat.wkflow.business_oa.utils;
+
+import okhttp3.*;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+@Component
+public class OkHttpUtil {
+ private static final Logger logger = LoggerFactory.getLogger(OkHttpUtil.class);
+
+ @Autowired
+ private OkHttpClient okHttpClient;
+ /**
+ * get
+ *
+ * @param url 请求的url
+ * @param queries 请求的参数,在浏览器?后面的数据,没有可以传null
+ * @return
+ */
+ public String get(String url, Map queries, Map headerParams) {
+ String responseBody = "";
+ StringBuffer sb = new StringBuffer(url);
+ if (queries != null && queries.keySet().size() > 0) {
+ boolean firstFlag = true;
+ Iterator iterator = queries.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ if (firstFlag) {
+ sb.append("?" + entry.getKey() + "=" + entry.getValue());
+ firstFlag = false;
+ } else {
+ sb.append("&" + entry.getKey() + "=" + entry.getValue());
+ }
+ }
+ }
+
+ Request.Builder requestBuilder = new Request.Builder().url(url);
+
+ if(headerParams != null){
+ for(Map.Entry entry : headerParams.entrySet()) {
+ requestBuilder.addHeader(entry.getKey(), entry.getValue());
+ }
+ }
+
+
+ Request request = requestBuilder.url(sb.toString())
+ .build();
+ Response response = null;
+ try {
+ response = okHttpClient.newCall(request).execute();
+ int status = response.code();
+ if (status == 200) {
+ return response.body().string();
+ }
+ } catch (Exception e) {
+ logger.error("okhttp put error >> ex = {}", ExceptionUtils.getStackTrace(e));
+ } finally {
+ if (response != null) {
+ response.close();
+ }
+ }
+ return responseBody;
+ }
+ /**
+ * post
+ *
+ * @param url 请求的url
+ * @param params post form 提交的参数
+ * @return
+ */
+ public String post(String url, Map params, Map headerParams) {
+ String responseBody = "";
+ FormBody.Builder builder = new FormBody.Builder();
+ //添加参数
+ if (params != null && params.keySet().size() > 0) {
+ for (String key : params.keySet()) {
+ builder.add(key, params.get(key));
+ }
+ }
+
+ Request.Builder requestBuilder = new Request.Builder().url(url);
+
+ for(Map.Entry entry : headerParams.entrySet()) {
+ requestBuilder.addHeader(entry.getKey(), entry.getValue());
+ }
+
+ Request request = requestBuilder.post(builder.build()).build();
+ Response response = null;
+ try {
+ response = okHttpClient.newCall(request).execute();
+ int status = response.code();
+ if (status == 200) {
+ return response.body().string();
+ }
+ } catch (Exception e) {
+ logger.error("okhttp post error >> ex = {}", ExceptionUtils.getStackTrace(e));
+ } finally {
+ if (response != null) {
+ response.close();
+ }
+ }
+ return responseBody;
+ }
+
+ /**
+ 47
+ * 同步GET请求 带Authorization认证
+ 48
+ */
+
+ public String getAuthorization(String get_url, String json, String[] auth_base){
+
+
+ final String credential = Credentials.basic(auth_base[0], auth_base[1]);
+ String result = "";
+ String data_url = get_url + "?" + json;
+ Request request = new Request.Builder()
+ .url(data_url)
+ .header("Authorization", credential)
+ .get()
+ .build();
+ Response response = null;
+ try {
+ response = okHttpClient.newCall(request).execute();
+ int status = response.code();
+ if (status == 200) {
+ return response.body().string();
+ }
+ } catch (Exception e) {
+ logger.error("okhttp post error >> ex = {}", ExceptionUtils.getStackTrace(e));
+ } finally {
+ if (response != null) {
+ response.close();
+ }
+ }
+ return result;
+
+ }
+
+ /**
+ * Post请求 带Authorization认证
+ * */
+ public String postAuthorization(String get_url, HashMap getData, String[] authBase){
+
+ String result = "";
+
+ final String credential = Credentials.basic(authBase[0], authBase[1]);
+
+ RequestBody fromBody = generateParametersForPost(getData).build();
+
+ Request request = new Request.Builder()
+ .url(get_url)
+ .header("Authorization", credential)
+ .post(fromBody)
+ .build();
+
+ Response response = null;
+ try {
+ response = okHttpClient.newCall(request).execute();
+ int status = response.code();
+ if (status == 200) {
+ return response.body().string();
+ }
+ } catch (Exception e) {
+ logger.error("okhttp post error >> ex = {}", ExceptionUtils.getStackTrace(e));
+ } finally {
+ if (response != null) {
+ response.close();
+ }
+ }
+ return result;
+
+ }
+
+ //拼接参数
+ private static String generateParameters(HashMap parameters) {
+
+ String urlAttachment = "";
+
+ if(parameters.size()>0){
+
+ urlAttachment = "?";
+
+ Object[] keys = parameters.keySet().toArray();
+
+ for(Object key : keys)
+
+ urlAttachment += key.toString() + "=" + parameters.get(key).toString() + "&";
+
+ urlAttachment = urlAttachment.substring(0,urlAttachment.length()-1);
+ }
+
+ return urlAttachment;
+ }
+
+ //拼接参数用于POST请求
+
+ private static FormBody.Builder generateParametersForPost(HashMap parameters) {
+
+ FormBody.Builder builder = new FormBody.Builder();
+
+ if(parameters.size()>0){
+ Object[] keys = parameters.keySet().toArray();
+
+ for(Object key : keys){
+ Object ff = parameters.get(key);
+ String aa = parameters.get(key).toString();
+
+ builder.add(key.toString(),parameters.get(key).toString());
+ }
+ }
+
+ return builder;
+ }
+
+ /**
+ * 发送私密API请求
+ *
+ * @paramget_url请求地址
+ * @paramget_data 请求参数列表
+ * @return 返回JSON数据
+ */
+ private String auth_get(){
+ String result = "";
+ String api_key = "apikey";
+ String api_secret = "apisecret";
+ //认证信息
+ String[] baseAuth = {api_key,api_secret};
+ //请求的URL的参数
+ HashMap get_data = new HashMap<>();
+ get_data.put("page","1"); //page参数
+ get_data.put("name","test"); //name参数
+// result = getAuthorization("http://www.superl.org/page-about.html", get_data, baseAuth);
+ return result;
+ }
+
+ /**
+ * post
+ *
+ * @param url 请求的url
+ * @param headerParams post form 提交的参数
+ * @return
+ */
+ public String postForJson(String url, String json, Map headerParams){
+ RequestBody requestBody = FormBody.create(MediaType.parse("application/json; charset=utf-8"), json);
+ String responseBody = "";
+ Request.Builder requestBuilder = new Request.Builder().url(url);
+ for(Map.Entry entry : headerParams.entrySet()) {
+ requestBuilder.addHeader(entry.getKey(), entry.getValue());
+ }
+ Request request = requestBuilder.post(requestBody).build();
+ Response response = null;
+ try {
+ response = okHttpClient.newCall(request).execute();
+ int status = response.code();
+ if (status == 200) {
+ return response.body().string();
+ }
+ } catch (Exception e) {
+ logger.error("okhttp post error >> ex = {}", ExceptionUtils.getStackTrace(e));
+ return "okhttp post error >> ex = {} "+ e.getMessage();
+ } finally {
+ if (response != null) {
+ response.close();
+ }
+ }
+ return responseBody;
+ }
+
+ /**
+ * post 上传文件
+ *
+ * @param url
+ * @param params
+ * @param fileType
+ * @return
+ */
+ public String postFile(String url, Map params, String fileType, Map headerParams) {
+ String responseBody = "";
+ MultipartBody.Builder builder = new MultipartBody.Builder();
+ //添加参数
+ if (params != null && params.keySet().size() > 0) {
+ for (String key : params.keySet()) {
+ if (params.get(key) instanceof File) {
+ File file = (File) params.get(key);
+ builder.addFormDataPart(key, file.getName(), RequestBody.create(MediaType.parse(fileType), file));
+ continue;
+ }
+ builder.addFormDataPart(key, params.get(key).toString());
+ }
+ }
+
+ Request.Builder requestBuilder = new Request.Builder();
+ for(Map.Entry entry : headerParams.entrySet()) {
+ requestBuilder.addHeader(entry.getKey(), entry.getValue());
+ }
+
+ Request request = requestBuilder.url(url).post(builder.build()).build();
+ Response response = null;
+ try {
+ response = okHttpClient.newCall(request).execute();
+ int status = response.code();
+ if (status == 200) {
+ return response.body().string();
+ }
+ } catch (Exception e) {
+ logger.error("okhttp postFile error >> ex = {}", ExceptionUtils.getStackTrace(e));
+ } finally {
+ if (response != null) {
+ response.close();
+ }
+ }
+ return responseBody;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java
new file mode 100644
index 00000000..c4a5a7f4
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java
@@ -0,0 +1,69 @@
+package com.ydw.bat.wkflow.business_oa.webService.controller;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.tmsps.fk.common.util.JsonUtil;
+import com.ydw.bat.wkflow.business_activiti.dto.*;
+import com.ydw.bat.wkflow.business_auth.LawsUserInfoService;
+import com.ydw.bat.wkflow.business_main.datas.entity.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSONArray;
+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.engine.*;
+import org.activiti.engine.history.*;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.runtime.ProcessInstanceQuery;
+import org.activiti.engine.task.NativeTaskQuery;
+import org.activiti.engine.task.Task;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.tmsps.fk.common.base.action.BaseAction;
+import com.tmsps.fk.common.util.ChkUtil;
+import com.tmsps.fk.common.wrapper.WrapMapper;
+import com.tmsps.fk.common.wrapper.Wrapper;
+import com.ydw.bat.wkflow.business_activiti.service.TaskTodoService;
+import com.ydw.bat.wkflow.util.activiti.ActivitiTools;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+
+@Api(description = "WebService管理")
+@RestController
+public class WebServiceOAController extends BaseAction {
+
+ @Autowired
+ private WebServiceOAService webServiceOAService;
+
+ @ApiOperation(value = "发送待办接口(")
+ @PostMapping("/sendTodo")
+ public NotifyTodoAppResult sendTodo() throws Exception{
+ return webServiceOAService.sendTodo(new BusProcessNew());
+ }
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/WebServiceOAService.java b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/WebServiceOAService.java
new file mode 100644
index 00000000..2c2bc19b
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/WebServiceOAService.java
@@ -0,0 +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(BusProcessNew busProcessNew) throws Exception;
+
+ NotifyTodoAppResult setTodoDone(NotifyTodoSendContext notifyTodoSendContext) throws Exception;
+
+}
diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/impl/WebServiceOAServiceImpl.java b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/impl/WebServiceOAServiceImpl.java
new file mode 100644
index 00000000..6b8515ad
--- /dev/null
+++ b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/service/impl/WebServiceOAServiceImpl.java
@@ -0,0 +1,179 @@
+package com.ydw.bat.wkflow.business_oa.webService.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.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_main.datas.service.IBusProcessNameService;
+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;
+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.NotifyTodoSendContext;
+import com.ydw.bat.wkflow.business_oa.webService.todoResult.NotifyTodoAppResult;
+import net.sf.json.JSONArray;
+import okhttp3.Credentials;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @Description: TODO
+ * @author: super_liu
+ * @date: 2021年09月08日 15:02
+ */
+@Service
+@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
+public class WebServiceOAServiceImpl implements WebServiceOAService {
+ private static final Logger log = LoggerFactory.getLogger(WebServiceOAServiceImpl.class);
+
+ private String sonar = "sonar";
+ private String info = "info:{},{}";
+ private String errMes = "异常信息:";
+
+ private String api_key = "OA";
+ private String api_secret = "TEST_oa201611241710";
+
+ @Value("${webUrl}")
+ private String webUrl;
+ //认证信息
+ private String[] baseAuth = {api_key,api_secret};
+ private String credentials = "";
+
+ @Autowired
+ private OkHttpUtil okHttpUtil;
+
+ @Autowired
+ private LawsUserInfoService lawsUserInfoService;
+
+ @Autowired
+ private IBusProcessNameService iBusProcessNameService;
+
+ public WebServiceOAServiceImpl(){
+ credentials = Credentials.basic(api_key,api_secret);
+ }
+
+ @Override
+ @Async
+ public NotifyTodoAppResult setTodoDone(NotifyTodoSendContext notifyTodoSendContext) throws Exception{
+ NotifyTodoAppResult notifyTodoAppResult = new NotifyTodoAppResult();
+ 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