|
@@ -1,9 +1,21 @@
|
|
|
package com.idea.workPanel.service;
|
|
|
|
|
|
+import cn.hutool.core.codec.Base64;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+import cn.hutool.crypto.SecureUtil;
|
|
|
+import cn.hutool.crypto.symmetric.AES;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.idea.oa.apply.util.constant.ConstantFlowType;
|
|
|
+import com.idea.oa.flow2.model.FlowMain;
|
|
|
+import com.idea.oa.flow2.model.FlowMainExample;
|
|
|
+import com.idea.oa.flow2.model.FlowMainPush;
|
|
|
+import com.idea.oa.flow2.model.FlowMainPushExample;
|
|
|
+import com.idea.oa.flow2.service.FlowMainPushService;
|
|
|
+import com.idea.oa.flow2.service.FlowMainService;
|
|
|
+import com.idea.util.DateUtils;
|
|
|
+import com.idea.util.OAUtil;
|
|
|
import com.idea.workPanel.enume.HandleTypeEnum;
|
|
|
import com.idea.workPanel.mapper.ParkWaitHandleMapper;
|
|
|
import com.idea.workPanel.mapper.ParkWaitHandleOnMapper;
|
|
@@ -26,12 +38,11 @@ import com.rockstar.util.StringUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
@@ -45,6 +56,14 @@ public class ParkWaitHandleService implements BaseService<ParkWaitHandle, ParkWa
|
|
|
private ParkWaitHandleOnMapper modelOnMapper;
|
|
|
@Autowired
|
|
|
private FramePermissionService framePermissionService;
|
|
|
+ @Value("${serverUrl}")
|
|
|
+ private String serverUrl;
|
|
|
+ @Value("${ssoKey}")
|
|
|
+ private String ssoKey;
|
|
|
+ @Autowired
|
|
|
+ private FlowMainPushService flowMainPushService;
|
|
|
+ @Autowired
|
|
|
+ private FlowMainService flowMainService;
|
|
|
|
|
|
@Override
|
|
|
public int deleteByPrimaryKey(String ids) {
|
|
@@ -302,4 +321,278 @@ public class ParkWaitHandleService implements BaseService<ParkWaitHandle, ParkWa
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 泛微刷新 待办
|
|
|
+ * @param flowMainPush
|
|
|
+ * @param flowMain
|
|
|
+ */
|
|
|
+ public void userHandleOa(FlowMainPush flowMainPush, FlowMain flowMain) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ String flowId = flowMain.getId();
|
|
|
+ String receiveUserId = flowMainPush.getPushUser();
|
|
|
+ FrameUser receiveUser = frameUserService.selectByPrimaryKey(receiveUserId);
|
|
|
+ String username = encryptUsername(receiveUser.getUsername());
|
|
|
+ String syscode = "AJ";
|
|
|
+ String requestname = flowMain.getApplyTheme();
|
|
|
+ String workflowname = ConstantFlowType.PAYMENT_NAME;
|
|
|
+ String nodeName = flowMainPush.getNodeName();
|
|
|
+ String pcurl = serverUrl + "&loginid=" + username;
|
|
|
+ String appurl = "";
|
|
|
+ String isremark = "0";
|
|
|
+ String viewtype = "0";
|
|
|
+ // TODO: 2024/11/15 创建者和接收者需求oa协商
|
|
|
+ String creator = "ceshi";
|
|
|
+ String receiver = "ceshi";
|
|
|
+ String date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
|
|
|
+ String receivets = System.currentTimeMillis() + "";
|
|
|
+
|
|
|
+ Map map = new HashMap<String, Object>();
|
|
|
+ map.put("syscode", syscode);
|
|
|
+ map.put("flowid", flowId);
|
|
|
+ map.put("requestname", requestname);
|
|
|
+ map.put("workflowname", workflowname);
|
|
|
+ map.put("nodeName", nodeName);
|
|
|
+ map.put("pcurl", pcurl);
|
|
|
+ map.put("appurl", appurl);
|
|
|
+ map.put("creator", creator);
|
|
|
+ map.put("createdatetime", date);
|
|
|
+ map.put("receiver", receiver);
|
|
|
+ map.put("receivedatetime", date);
|
|
|
+ map.put("isremark", isremark);
|
|
|
+ map.put("viewtype", viewtype);
|
|
|
+ map.put("receivets", receivets);
|
|
|
+
|
|
|
+ log.info("泛微刷新待办详情:{}", map);
|
|
|
+ String result = OAUtil.receiveRequestInfoByJson(map);
|
|
|
+ log.info("泛微刷新待办结果:{}", result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送异常", e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 泛微刷新 待办
|
|
|
+ * @param flowMainPushId
|
|
|
+ * @param flowMain
|
|
|
+ */
|
|
|
+ public void userHandleOa(String flowMainPushId, FlowMain flowMain) {
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ FlowMainPush flowMainPush = flowMainPushService.selectByPrimaryKey(flowMainPushId);
|
|
|
+ String flowId = flowMain.getId();
|
|
|
+ String receiveUserId = flowMainPush.getPushUser();
|
|
|
+ FrameUser receiveUser = frameUserService.selectByPrimaryKey(receiveUserId);
|
|
|
+ String username = encryptUsername(receiveUser.getUsername());
|
|
|
+ String syscode = "AJ";
|
|
|
+ String requestname = flowMain.getApplyTheme();
|
|
|
+ String workflowname = ConstantFlowType.PAYMENT_NAME;
|
|
|
+ String nodeName = flowMainPush.getNodeName();
|
|
|
+ String pcurl = serverUrl + "&loginid=" + username;
|
|
|
+ String appurl = "";
|
|
|
+ String isremark = "0";
|
|
|
+ String viewtype = "0";
|
|
|
+ // TODO: 2024/11/15 创建者和接收者需求oa协商
|
|
|
+ String creator = "ceshi";
|
|
|
+ String receiver = "ceshi";
|
|
|
+ String date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
|
|
|
+ String receivets = System.currentTimeMillis() + "";
|
|
|
+
|
|
|
+ Map map = new HashMap<String, Object>();
|
|
|
+ map.put("syscode", syscode);
|
|
|
+ map.put("flowid", flowId);
|
|
|
+ map.put("requestname", requestname);
|
|
|
+ map.put("workflowname", workflowname);
|
|
|
+ map.put("nodeName", nodeName);
|
|
|
+ map.put("pcurl", pcurl);
|
|
|
+ map.put("appurl", appurl);
|
|
|
+ map.put("creator", creator);
|
|
|
+ map.put("createdatetime", date);
|
|
|
+ map.put("receiver", receiver);
|
|
|
+ map.put("receivedatetime", date);
|
|
|
+ map.put("isremark", isremark);
|
|
|
+ map.put("viewtype", viewtype);
|
|
|
+ map.put("receivets", receivets);
|
|
|
+
|
|
|
+ log.info("泛微刷新待办详情:{}", map);
|
|
|
+ String result = OAUtil.receiveRequestInfoByJson(map);
|
|
|
+ log.info("泛微刷新待办结果:{}", result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送异常", e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发起流程 推送泛微和工作台待办
|
|
|
+ * @param id
|
|
|
+ * @param applyTheme
|
|
|
+ */
|
|
|
+ public void startOaAndHandle(String id,String applyTheme,HandleTypeEnum typeEnum) {
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ String flowId = "";
|
|
|
+ String nodeName = "";
|
|
|
+
|
|
|
+ FlowMainExample flowMainExample = new FlowMainExample();
|
|
|
+ flowMainExample.createCriteria().andFormIdEqualTo(id).andFlowTypeEqualTo(ConstantFlowType.PAYMENT);
|
|
|
+ List<FlowMain> flowMains = flowMainService.selectByExample(flowMainExample);
|
|
|
+ if (CollectionUtils.isNotEmpty(flowMains)) {
|
|
|
+ FlowMain flowMain = flowMains.get(0);
|
|
|
+ flowId = flowMain.getId();
|
|
|
+
|
|
|
+ FlowMainPushExample flowMainPushExample = new FlowMainPushExample();
|
|
|
+ flowMainPushExample.createCriteria().andFlowMainIdEqualTo(flowId).andStatusEqualTo(0);
|
|
|
+ List<FlowMainPush> flowMainPushes = flowMainPushService.selectByExample(flowMainPushExample);
|
|
|
+ if (CollectionUtils.isNotEmpty(flowMainPushes)) {
|
|
|
+ FlowMainPush flowMainPush = flowMainPushes.get(0);
|
|
|
+ nodeName = flowMainPush.getNodeName();
|
|
|
+
|
|
|
+ String title = applyTheme;
|
|
|
+
|
|
|
+ Integer srcUserType = 0;//来源用户类型 0管理,1企业
|
|
|
+ String srcUserId = ShiroUtils.getUserId();
|
|
|
+ String srcUserName = ShiroUtils.getUser().getTruename();
|
|
|
+ String receiveUserId = flowMainPush.getPushUser();
|
|
|
+ String routeParam = "id=" + flowId + "&flowMainPushId=" + flowMainPush.getId() + "&applyUser=" + flowMain.getApplyUser();
|
|
|
+ addHandle(title, typeEnum, srcUserType, srcUserId, srcUserName, receiveUserId, routeParam);
|
|
|
+
|
|
|
+ // TODO: 2024/11/21 和泛OA对接 推送待办
|
|
|
+ FrameUser receiveUser = frameUserService.selectByPrimaryKey(receiveUserId);
|
|
|
+ String username = encryptUsername(receiveUser.getUsername());
|
|
|
+ String syscode = "AJ";
|
|
|
+ String requestname = applyTheme;
|
|
|
+ String workflowname = ConstantFlowType.PAYMENT_NAME;
|
|
|
+ String pcurl = serverUrl + "&loginid=" + username;
|
|
|
+ String appurl = "";
|
|
|
+ String isremark = "0";
|
|
|
+ String viewtype = "0";
|
|
|
+ // TODO: 2024/11/15 创建者和接收者需求oa协商
|
|
|
+ String creator = "ceshi";
|
|
|
+ String receiver = "ceshi";
|
|
|
+ String date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
|
|
|
+ String receivets = System.currentTimeMillis() + "";
|
|
|
+ Map map = new HashMap<String, Object>();
|
|
|
+ map.put("syscode", syscode);
|
|
|
+ map.put("flowid", flowId);
|
|
|
+ map.put("requestname", requestname);
|
|
|
+ map.put("workflowname", workflowname);
|
|
|
+ map.put("nodeName", nodeName);
|
|
|
+ map.put("pcurl", pcurl);
|
|
|
+ map.put("appurl", appurl);
|
|
|
+ map.put("creator", creator);
|
|
|
+ map.put("createdatetime", date);
|
|
|
+ map.put("receiver", receiver);
|
|
|
+ map.put("receivedatetime", date);
|
|
|
+ map.put("isremark", isremark);
|
|
|
+ map.put("viewtype", viewtype);
|
|
|
+ map.put("receivets", receivets);
|
|
|
+
|
|
|
+ log.info("泛微推送详情:{}", map);
|
|
|
+ String result = OAUtil.receiveRequestInfoByJson(map);
|
|
|
+ log.info("泛微推送结果:{}", result);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 推送泛微和工作台待办
|
|
|
+ *
|
|
|
+ * @param flowMainPush
|
|
|
+ * @param flowMain
|
|
|
+ * @param typeEnum
|
|
|
+ */
|
|
|
+ public void pushOaAndHandle(FlowMainPush flowMainPush, FlowMain flowMain, HandleTypeEnum typeEnum) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ String flowId = flowMain.getId();
|
|
|
+ FlowMainPushExample flowMainPushExample = new FlowMainPushExample();
|
|
|
+ flowMainPushExample.createCriteria().andFlowMainIdEqualTo(flowId).andStatusEqualTo(0);
|
|
|
+ List<FlowMainPush> flowMainPushes = flowMainPushService.selectByExample(flowMainPushExample);
|
|
|
+ if (CollectionUtils.isNotEmpty(flowMainPushes)) {
|
|
|
+ FlowMainPush push = flowMainPushes.get(0);
|
|
|
+
|
|
|
+ String title = flowMain.getApplyTheme();
|
|
|
+
|
|
|
+ Integer srcUserType = 0;//来源用户类型 0管理,1企业
|
|
|
+ String srcUserId = ShiroUtils.getUserId();
|
|
|
+ String srcUserName = ShiroUtils.getUser().getTruename();
|
|
|
+ String receiveUserId = push.getPushUser();
|
|
|
+ String routeParam = "id=" + flowId + "&flowMainPushId=" + push.getId() + "&applyUser=" + flowMain.getApplyUser();
|
|
|
+ addHandle(title, typeEnum, srcUserType, srcUserId, srcUserName, receiveUserId, routeParam);
|
|
|
+
|
|
|
+ // TODO: 2024/11/21 和泛微对接 推送信息
|
|
|
+ FrameUser receiveUser = frameUserService.selectByPrimaryKey(receiveUserId);
|
|
|
+ String username = encryptUsername(receiveUser.getUsername());
|
|
|
+ String syscode = "AJ";
|
|
|
+ String requestname = flowMain.getApplyTheme();
|
|
|
+ String workflowname = ConstantFlowType.PAYMENT_NAME;
|
|
|
+ String nodeName = flowMainPush.getNodeName();
|
|
|
+ String pcurl = serverUrl + "&loginid=" + username;
|
|
|
+ String appurl = "";
|
|
|
+ String isremark = "0";
|
|
|
+ String viewtype = "0";
|
|
|
+ // TODO: 2024/11/15 创建者和接收者需求oa协商
|
|
|
+ String creator = "ceshi";
|
|
|
+ String receiver = "ceshi";
|
|
|
+ String date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
|
|
|
+ String receivets = System.currentTimeMillis() + "";
|
|
|
+
|
|
|
+ Map map = new HashMap<String, Object>();
|
|
|
+ map.put("syscode", syscode);
|
|
|
+ map.put("flowid", flowId);
|
|
|
+ map.put("requestname", requestname);
|
|
|
+ map.put("workflowname", workflowname);
|
|
|
+ map.put("nodeName", nodeName);
|
|
|
+ map.put("pcurl", pcurl);
|
|
|
+ map.put("appurl", appurl);
|
|
|
+ map.put("creator", creator);
|
|
|
+ map.put("createdatetime", date);
|
|
|
+ map.put("receiver", receiver);
|
|
|
+ map.put("receivedatetime", date);
|
|
|
+ map.put("isremark", isremark);
|
|
|
+ map.put("viewtype", viewtype);
|
|
|
+ map.put("receivets", receivets);
|
|
|
+
|
|
|
+ log.info("泛微推送待办详情:{}", map);
|
|
|
+ String result = OAUtil.receiveRequestInfoByJson(map);
|
|
|
+ log.info("泛微推送待办结果:{}", result);
|
|
|
+
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送异常", e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 加密用户名
|
|
|
+ *
|
|
|
+ * @param username
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String encryptUsername(String username) {
|
|
|
+
|
|
|
+ byte[] key = Base64.decode(ssoKey);
|
|
|
+ // 构建
|
|
|
+ AES aes = SecureUtil.aes(key);
|
|
|
+ return aes.encryptHex(username);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|