Browse Source

新增广药MQ

wangliang 2 years ago
parent
commit
f167e60f35

+ 191 - 0
cas/src/main/java/com/qmth/teachcloud/cas/mq/gdpu/api/GdpuMqController.java

@@ -0,0 +1,191 @@
+package com.qmth.teachcloud.cas.mq.gdpu.api;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.qmth.boot.api.annotation.Aac;
+import com.qmth.boot.api.annotation.BOOL;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.teachcloud.cas.mq.gdpu.bean.*;
+import com.qmth.teachcloud.exchange.common.contant.SystemConstant;
+import com.qmth.teachcloud.exchange.common.util.HttpUtil;
+import com.qmth.teachcloud.exchange.common.util.Result;
+import com.qmth.teachcloud.exchange.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+@Api(tags = "广东药科大学获取流程事项controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_GDPU)
+@Aac(auth = BOOL.FALSE)
+@Validated
+public class GdpuMqController {
+    private final static Logger log = LoggerFactory.getLogger(GdpuMqController.class);
+
+    @RequestMapping(value = "/todotask/send", method = RequestMethod.POST)
+    @ApiOperation(value = "推送流程信息")
+    @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
+    public Result toDoTask(@ApiParam(value = "流程ID(所属应用的ID号+使用业务系统中该流程实例的主键,拼接一起)", required = true) @RequestParam String docunId,
+                           @ApiParam(value = "所属应用的ID号(由学校管理员提供)", required = true) @RequestParam String sysAppId) throws IOException {
+        Map<String, Object> params = new LinkedHashMap<>();
+        params.put(SystemConstant.GDPU_DOCUN_ID, sysAppId + docunId);
+        params.put(SystemConstant.GDPU_SYS_APP_ID, sysAppId);
+        String dateStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
+        String encryptedvalue = DigestUtils.md5Hex(SystemConstant.GDPU_APP_ID + SystemConstant.GDPU_APP_SECRET + dateStr).toUpperCase();
+        String result = HttpUtil.postGdpu(SystemConstant.GDPU_MQ_PUSH_URL, params, SystemConstant.GDPU_APP_ID, encryptedvalue, System.currentTimeMillis());
+        log.info("result:{}", result);
+        return ResultUtil.ok(true);
+    }
+
+    @RequestMapping(value = "/getbacklog", method = RequestMethod.POST)
+    @ApiOperation(value = "获取流程事项信息")
+    @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
+    public JSONObject syncAffairInfo(@ApiParam(value = "appid", required = true) @RequestHeader String appid,
+                                     @ApiParam(value = "签名串", required = true) @RequestHeader String secret,
+                                     @ApiParam(value = "流程id", required = true) @RequestHeader String orunId) {
+        //校验secret
+        String dateStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
+        String encryptedvalue = DigestUtils.md5Hex(appid + SystemConstant.GDPU_APP_SECRET + dateStr).toUpperCase();
+        JSONObject result = new JSONObject();
+        JSONObject content = new JSONObject();
+        if (!encryptedvalue.equals(secret)) {
+            content.put("code", "501");
+            content.put("message", "加密串校验失败!");
+            result.put("content", content);
+            return result;
+        }
+        String sysAppId = "znks";
+        String flowId = "401331061809741824";
+        String docunId = sysAppId + flowId;
+        JSONObject data = new JSONObject();
+        JSONArray processInfo = new JSONArray(); //主流程信息
+        if (orunId != null) {
+            ProcessInfoDTO processInfoDTO = new ProcessInfoDTO();
+            processInfoDTO.setSysAppId(sysAppId);
+            processInfoDTO.setOrunId(docunId);
+            // TODO 根据业务系统和场景,传入参数。
+            setProcessInfoDTO(processInfoDTO, flowId);
+            processInfo.add(processInfoDTO);
+        }
+        JSONArray todoInfo = new JSONArray(); //待办信息
+        if (orunId != null) {
+            TodoInfoDTO todoInfoDTO = new TodoInfoDTO();
+            todoInfoDTO.setOrunId(orunId);
+            // TODO 根据业务系统和场景,传入参数。
+            setTodoInfoDTO(todoInfoDTO, flowId);
+            todoInfo.add(todoInfoDTO);
+        }
+//        JSONArray toreadInfo = new JSONArray(); //待阅信息
+//        if (orunId != null) {
+//            ToReadInfoDTO toReadInfoDTO = new ToReadInfoDTO();
+//            // TODO 根据业务系统和场景,传入待阅参数,如无数据,则无需传参。
+//            setToReadInfoDTO(toReadInfoDTO);
+//            toreadInfo.add(toReadInfoDTO);
+//        }
+//        JSONArray remarkInfo = new JSONArray(); //已办信息
+//        if (orunId != null) {
+//            RemarkInfoDTO remarkInfoDTO = new RemarkInfoDTO();
+//            // TODO 根据业务系统和场景,传入触发本次操作的办理信息参数。
+//            setRemarkInfoDTO(remarkInfoDTO);
+//            remarkInfo.add(remarkInfoDTO);
+//        }
+        data.put("processInfo", processInfo);
+        data.put("todoInfo", todoInfo);
+//        data.put("toreadInfo", toreadInfo);
+//        data.put("remarkInfo", remarkInfo);
+        content.put("statusCode", 200);
+        content.put("success", true);
+        content.put("message", "操作成功!");
+        content.put("data", data);
+        log.info("content:{}", content.toJSONString());
+//请求参数body内容加密
+        try {
+            result.put("content", AESEncryptUtils.aesEncrypt(content.toJSONString(), SystemConstant.GDPU_APP_SECRET.substring(0, 16)));
+        } catch (Exception e) {
+            System.out.println("AES加密失败");
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+        return result;
+    }
+
+    private void setProcessInfoDTO(ProcessInfoDTO processInfoDTO, String flowId) {
+//        processInfoDTO.setSysAppId("LYOA");
+//        processInfoDTO.setOrunId("LYOA79ec0af89702d641d839d5bbb5e9073b0e4b");
+        processInfoDTO.setSubject("测试流程");
+        processInfoDTO.setCurrentNodeId("T10004");
+        processInfoDTO.setCurrentNodeName("拟稿");
+        processInfoDTO.setStatus("Current");
+        processInfoDTO.setUserId("znkspt"); //申请人ID
+        processInfoDTO.setUserName("znkspt"); //申请人名称
+        processInfoDTO.setAuthor("znkspt"); //当前审批人的账户ID(多个使用逗号分隔(示例:2007112, admin))
+        processInfoDTO.setAuthorCn("znkspt"); //当前审批人的账户名称(多个使用逗号分隔(示例:2007112, admin))
+        processInfoDTO.setUrl("https://portal.lysky.com:6205/bpmui/formRender/run?docUnid=" + flowId);
+        processInfoDTO.setMobileUrl("https://portal.lysky.com:6205/bpmui/formRender/run?docUnid=" + flowId);
+        processInfoDTO.setDocAddTime(new Date());// "2022-07-25 02:36:00"
+        processInfoDTO.setDesc("描述");
+    }
+
+    private void setTodoInfoDTO(TodoInfoDTO todoInfoDTO, String flowId) {
+        todoInfoDTO.setUserId("znkspt");
+        todoInfoDTO.setUserName("znkspt");
+        todoInfoDTO.setStartTime("2023-06-13 12:15:10");
+//        todoInfoDTO.setOrunId("a18a585c07b1c04cb00b66e0b76ca9ab1359");
+        todoInfoDTO.setNodeId("T10005");
+        todoInfoDTO.setNodeName("部门审批");
+        todoInfoDTO.setUrl("https://portal.lysky.com:6205/bpmui/#/formRender/run?docUnid=" + flowId);
+        todoInfoDTO.setMobileUrl("https://portal.lysky.com:6205/bpmui/#/formRender/run?docUnid=" + flowId);
+        todoInfoDTO.setStatus("Current"); //当出现或签、抢占流程时,需要将其他未办理用户设置为Pause状态。
+    }
+
+    //以审批通过为例,给出办理记录DTO的数据填充demo
+    private void setRemarkInfoDTO(RemarkInfoDTO remarkInfoDTO) {
+        remarkInfoDTO.setNodeId("T10006");
+        remarkInfoDTO.setNodeName("校领导审批");
+        remarkInfoDTO.setStartTime("2022-07-25 18:21:00");
+        remarkInfoDTO.setEndTime("2022-07-26 18:21:10");
+        remarkInfoDTO.setActionName("同意");
+        remarkInfoDTO.setUserId("admin");
+        remarkInfoDTO.setUserName("超级管理员");
+//        remarkInfoDTO.setOrunId("4519915c090cd0452208f610ef5f146920b3");
+        remarkInfoDTO.setRemark("同意本流程--审批通过");
+        remarkInfoDTO.setUrl("https://portal.lysky.com:6205/bpmui/#/formRender/run?docUnid=79ec0af89702d641d839d5bbb5e9073b0e4b");
+        remarkInfoDTO.setMobileUrl("https://portal.lysky.com:6205/bpmui/#/formRender/run?docUnid=79ec0af89702d641d839d5bbb5e9073b0e4b");
+    }
+
+    private void setToReadInfoDTO(ToReadInfoDTO toReadInfoDTO) {
+        JSONArray toReadUsers = new JSONArray();
+//根据场景 -- 插入待阅用户记录
+        JSONObject toReadUser1 = new JSONObject();
+        toReadUser1.put("toReadUserId", "admin");
+        toReadUser1.put("toReadUserName", "超级管理员");
+        toReadUser1.put("Status", "Current");
+        toReadUser1.put("remark", null);
+        toReadUser1.put("startTime", "2022-12-09 17:34:46");
+        toReadUsers.add(toReadUser1);
+//根据场景 -- 更新已阅用户记录
+        JSONObject toReadUser2 = new JSONObject();
+        toReadUser2.put("toReadUserId", "admin");
+        toReadUser2.put("toReadUserName", "超级管理员");
+        toReadUser2.put("Status", "End");
+        toReadUser2.put("remark", "已读");
+        toReadUser2.put("startTime", "2022-12-09 17:34:46");
+        toReadUser2.put("readTime", "2022-12-10 17:34:46");
+        toReadUsers.add(toReadUser2);
+        toReadInfoDTO.setToReadUser(toReadUsers);
+//        toReadInfoDTO.setOrunId("a18a585c07b1c04cb00b66e0b76ca9125456");
+        toReadInfoDTO.setNodeId("T10005");
+        toReadInfoDTO.setUrl("https://portal.lysky.com:6205/bpmui/#/formRender/run?docUnid=79ec0af89702d641d839d5bbb5e9073b0e4b");
+        toReadInfoDTO.setMobileUrl("https://portal.lysky.com:6205/bpmui/#/formRender/run?docUnid=79ec0af89702d641d839d5bbb5e9073b0e4b");
+        toReadInfoDTO.setNodeName("部门审批");
+    }
+}

+ 98 - 0
cas/src/main/java/com/qmth/teachcloud/cas/mq/gdpu/bean/AESEncryptUtils.java

@@ -0,0 +1,98 @@
+package com.qmth.teachcloud.cas.mq.gdpu.bean;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.spec.SecretKeySpec;
+
+@SuppressWarnings("restriction")
+public class AESEncryptUtils {
+    /**
+     * 算法
+     */
+    private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding";
+
+    /**
+     * base 64 encode
+     *
+     * @param bytes 待编码的byte[]
+     * @return 编码后的base 64 code
+     */
+    private static String base64Encode(byte[] bytes) {
+        return Base64.encodeBase64String(bytes);
+    }
+
+    /**
+     * base 64 decode
+     *
+     * @param base64Code 待解码的base 64 code
+     * @return 解码后的byte[]
+     * @throws Exception 抛出异常
+     */
+    private static byte[] base64Decode(String base64Code) throws Exception {
+        return StringUtils.isEmpty(base64Code) ? null :
+                Base64.decodeBase64(base64Code);
+    }
+
+    /**
+     * AES加密
+     *
+     * @param content    待加密的内容
+     * @param encryptKey 加密密钥
+     * @return 加密后的byte[]
+     */
+    private static byte[] aesEncryptToBytes(String content, String encryptKey)
+            throws Exception {
+        KeyGenerator kgen = KeyGenerator.getInstance("AES");
+        kgen.init(128);
+        Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
+        cipher.init(Cipher.ENCRYPT_MODE, new
+                SecretKeySpec(encryptKey.getBytes(), "AES"));
+        return cipher.doFinal(content.getBytes("utf-8"));
+    }
+
+    /**
+     * AES加密为base 64 code
+     *
+     * @param content    待加密的内容
+     * @param encryptKey 加密密钥
+     * @return 加密后的base 64 code
+     */
+    public static String aesEncrypt(String content, String encryptKey) throws
+            Exception {
+        return base64Encode(aesEncryptToBytes(content, encryptKey));
+    }
+
+    /**
+     * AES解密
+     *
+     * @param encryptBytes 待解密的byte[]
+     * @param decryptKey   解密密钥
+     * @return 解密后的String
+     */
+    private static String aesDecryptByBytes(byte[] encryptBytes, String
+            decryptKey) throws Exception {
+        KeyGenerator kgen = KeyGenerator.getInstance("AES");
+        kgen.init(128);
+        Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
+        cipher.init(Cipher.DECRYPT_MODE, new
+                SecretKeySpec(decryptKey.getBytes(), "AES"));
+        byte[] decryptBytes = cipher.doFinal(encryptBytes);
+        return new String(decryptBytes);
+    }
+
+    /**
+     * 将base 64 code AES解密
+     *
+     * @param encryptStr 待解密的base 64 code
+     * @param decryptKey 解密密钥
+     * @return 解密后的string
+     */
+    public static String aesDecrypt(String encryptStr, String decryptKey) throws
+            Exception {
+        return StringUtils.isEmpty(encryptStr) ? null :
+                aesDecryptByBytes(base64Decode(encryptStr), decryptKey.substring(0, 16));
+    }
+}

+ 274 - 0
cas/src/main/java/com/qmth/teachcloud/cas/mq/gdpu/bean/ProcessInfoDTO.java

@@ -0,0 +1,274 @@
+package com.qmth.teachcloud.cas.mq.gdpu.bean;
+
+import java.util.Date;
+
+/**
+ * 主流程表DTO
+ */
+public class ProcessInfoDTO {
+    /**
+     * 紧急程度
+     */
+    private String priorityCode;
+    /**
+     * 节点经办人,且结办过的
+     */
+    private String endUser;
+    /**
+     * 当前审批者账号
+     */
+    private String author;
+    /**
+     * 当前审批者姓名
+     */
+    private String authorCn;
+    /**
+     * 当前所在节点id
+     */
+    private String currentNodeId;
+    /**
+     * 流程当前所处的节点名称
+     */
+    private String currentNodeName;
+    /**
+     * 总耗时
+     */
+    private String totalTime;
+    /**
+     * 阅读过的人,点击查看过事务的也算
+     */
+    private String allReaders;
+    /**
+     * 流程当前状态
+     */
+    private String status;
+    /**
+     * 链接地址
+     */
+    private String url;
+    /**
+     * 移动端的地址,为空时取链接地址
+     */
+    private String mobileUrl;
+    /**
+     * 文档创建时间
+     */
+    private Date docAddTime;
+    /**
+     * 所属应用的ID号
+     */
+    private String sysAppId;
+    /**
+     * 所属流程名称
+     */
+    private String processName;
+    /**
+     * 所属流程id
+     */
+    private String processId;
+    /**
+     * 流水号,唯一标识
+     TodoInfoDTO 类
+     */
+    private String orunId;
+    /**
+     * 申请人账号
+     */
+    private String userId;
+    /**
+     * 申请人姓名
+     */
+    private String userName;
+    /**
+     * 流水标题
+     */
+    private String subject;
+    /**
+     * 流程办理截止时间
+     */
+    private Date deadLineTime;
+    /**
+     * 文档办结时间
+     */
+    private Date docEndTime;
+    /**
+     * 事务描述
+     */
+    private String desc;
+
+    public String getPriorityCode() {
+        return priorityCode;
+    }
+
+    public void setPriorityCode(String priorityCode) {
+        this.priorityCode = priorityCode;
+    }
+
+    public String getEndUser() {
+        return endUser;
+    }
+
+    public void setEndUser(String endUser) {
+        this.endUser = endUser;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+
+    public String getAuthorCn() {
+        return authorCn;
+    }
+
+    public void setAuthorCn(String authorCn) {
+        this.authorCn = authorCn;
+    }
+
+    public String getCurrentNodeId() {
+        return currentNodeId;
+    }
+
+    public void setCurrentNodeId(String currentNodeId) {
+        this.currentNodeId = currentNodeId;
+    }
+
+    public String getCurrentNodeName() {
+        return currentNodeName;
+    }
+
+    public void setCurrentNodeName(String currentNodeName) {
+        this.currentNodeName = currentNodeName;
+    }
+
+    public String getTotalTime() {
+        return totalTime;
+    }
+
+    public void setTotalTime(String totalTime) {
+        this.totalTime = totalTime;
+    }
+
+    public String getAllReaders() {
+        return allReaders;
+    }
+
+    public void setAllReaders(String allReaders) {
+        this.allReaders = allReaders;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getMobileUrl() {
+        return mobileUrl;
+    }
+
+    public void setMobileUrl(String mobileUrl) {
+        this.mobileUrl = mobileUrl;
+    }
+
+    public Date getDocAddTime() {
+        return docAddTime;
+    }
+
+    public void setDocAddTime(Date docAddTime) {
+        this.docAddTime = docAddTime;
+    }
+
+    public String getSysAppId() {
+        return sysAppId;
+    }
+
+    public void setSysAppId(String sysAppId) {
+        this.sysAppId = sysAppId;
+    }
+
+    public String getProcessName() {
+        return processName;
+    }
+
+    public void setProcessName(String processName) {
+        this.processName = processName;
+    }
+
+    public String getProcessId() {
+        return processId;
+    }
+
+    public void setProcessId(String processId) {
+        this.processId = processId;
+    }
+
+    public String getOrunId() {
+        return orunId;
+    }
+
+    public void setOrunId(String orunId) {
+        this.orunId = orunId;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public Date getDeadLineTime() {
+        return deadLineTime;
+    }
+
+    public void setDeadLineTime(Date deadLineTime) {
+        this.deadLineTime = deadLineTime;
+    }
+
+    public Date getDocEndTime() {
+        return docEndTime;
+    }
+
+    public void setDocEndTime(Date docEndTime) {
+        this.docEndTime = docEndTime;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+}

+ 187 - 0
cas/src/main/java/com/qmth/teachcloud/cas/mq/gdpu/bean/RemarkInfoDTO.java

@@ -0,0 +1,187 @@
+package com.qmth.teachcloud.cas.mq.gdpu.bean;
+
+/**
+ * 流转表DTO
+ */
+public class RemarkInfoDTO {
+    /**
+     * 完成时间
+     */
+    private String endTime;
+    /**
+     * 唯一标志
+     */
+    private String orunId;
+    /**
+     * 需要办理的节点编号
+     */
+    private String nodeId;
+    /**
+     * 节点的地址,当每个节点都有独立的链接时使用改字段,为空时取主流程的地址
+     */
+    private String url;
+    /**
+     * 移动端的地址,当每个节点都有独立的链接时使用改字段,为空时取节点的地址
+     */
+    private String mobileUrl;
+    /**
+     * 需要办理的节点名称
+     */
+    private String nodeName;
+    /**
+     * 节点批次,用来区分节点顺序
+     */
+    private String nodeBatch;
+    /**
+     * 状态 End,Current,Done
+     */
+    private String status;
+    /**
+     * 开始时间
+     */
+    private String startTime;
+    /**
+     * 耗时
+     */
+    private String difTime;
+    /**
+     * 操作类型名称 例:同意、不同意、通过、不通过
+     */
+    private String actionName;
+    /**
+     * 用户的ID
+     */
+    private String userId;
+    /**
+     * 需要办理的用户的姓名
+     */
+    private String userName;
+    /**
+     * 操作类型 agree、reject
+     */
+    private String actionId;
+    /**
+     * 办理意见
+     */
+    private String remark;
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getOrunId() {
+        return orunId;
+    }
+
+    public void setOrunId(String orunId) {
+        this.orunId = orunId;
+    }
+
+    public String getNodeId() {
+        return nodeId;
+    }
+
+    public void setNodeId(String nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getMobileUrl() {
+        return mobileUrl;
+    }
+
+    public void setMobileUrl(String mobileUrl) {
+        this.mobileUrl = mobileUrl;
+    }
+
+    public String getNodeName() {
+        return nodeName;
+    }
+
+    public void setNodeName(String nodeName) {
+        this.nodeName = nodeName;
+    }
+
+    public String getNodeBatch() {
+        return nodeBatch;
+    }
+
+    public void setNodeBatch(String nodeBatch) {
+        this.nodeBatch = nodeBatch;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getDifTime() {
+        return difTime;
+    }
+
+    public void setDifTime(String difTime) {
+        this.difTime = difTime;
+    }
+
+    public String getActionName() {
+        return actionName;
+    }
+
+    public void setActionName(String actionName) {
+        this.actionName = actionName;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getActionId() {
+        return actionId;
+    }
+
+    public void setActionId(String actionId) {
+        this.actionId = actionId;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}

+ 91 - 0
cas/src/main/java/com/qmth/teachcloud/cas/mq/gdpu/bean/ToReadInfoDTO.java

@@ -0,0 +1,91 @@
+package com.qmth.teachcloud.cas.mq.gdpu.bean;
+
+import com.alibaba.fastjson.JSONArray;
+
+public class ToReadInfoDTO {
+    /**
+     * 传阅人列表
+     */
+    private JSONArray toReadUser;
+    /**
+     * 唯一标识
+     */
+    private String orunId;
+    /**
+     * 节点id
+     * RemarkInfoDTO 类
+     */
+    private String nodeId;
+    /**
+     * 节点的地址,当每个节点都有独立的链接时使用改字段,为空时取主流程的地址
+     */
+    private String url;
+    /**
+     * 移动端的地址,当每个节点都有独立的链接时使用改字段,为空时取节点的地址
+     */
+    private String mobileUrl;
+    /**
+     * 节点名称
+     */
+    private String nodeName;
+    /**
+     * 待阅截止时间
+     */
+    private String toReadNodeEndTime;
+
+    public JSONArray getToReadUser() {
+        return toReadUser;
+    }
+
+    public void setToReadUser(JSONArray toReadUser) {
+        this.toReadUser = toReadUser;
+    }
+
+    public String getOrunId() {
+        return orunId;
+    }
+
+    public void setOrunId(String orunId) {
+        this.orunId = orunId;
+    }
+
+    public String getNodeId() {
+        return nodeId;
+    }
+
+    public void setNodeId(String nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getMobileUrl() {
+        return mobileUrl;
+    }
+
+    public void setMobileUrl(String mobileUrl) {
+        this.mobileUrl = mobileUrl;
+    }
+
+    public String getNodeName() {
+        return nodeName;
+    }
+
+    public void setNodeName(String nodeName) {
+        this.nodeName = nodeName;
+    }
+
+    public String getToReadNodeEndTime() {
+        return toReadNodeEndTime;
+    }
+
+    public void setToReadNodeEndTime(String toReadNodeEndTime) {
+        this.toReadNodeEndTime = toReadNodeEndTime;
+    }
+}

+ 198 - 0
cas/src/main/java/com/qmth/teachcloud/cas/mq/gdpu/bean/TodoInfoDTO.java

@@ -0,0 +1,198 @@
+package com.qmth.teachcloud.cas.mq.gdpu.bean;
+
+import java.util.Date;
+
+/**
+ * 用户流程启动实例DTO
+ */
+public class TodoInfoDTO {
+    /**
+     * 上个节点名称
+     */
+    private String preNodeName;
+    /**
+     * 当前节点办理截止时间
+     */
+    private Date nodeEndTime;
+    /**
+     * 上个节点id
+     */
+    private String preNodeId;
+    /**
+     * 结束时间
+     */
+    private String endTime;
+    /**
+     * 上个用户id
+     */
+    private String preUserId;
+    /**
+     * 上个用户名称
+     */
+    private String preUserName;
+    /**
+     * 是否已读
+     */
+    private Integer isRead;
+    /**
+     * 流水号id
+     */
+    private String orunId;
+    /**
+     * 节点id
+     */
+    private String nodeId;
+    /**
+     * 节点的地址,当每个节点都有独立的链接时使用改字段,为空时取主流程的地址
+     */
+    private String url;
+    /**
+     * 移动端的地址,当每个节点都有独立的链接时使用改字段,为空时取节点的地址
+     */
+    private String mobileUrl;
+    /**
+     * 节点名称
+     */
+    private String nodeName;
+    /**
+     * 当前状态Current表示活动,End表示结束,Waiting表示等待,Pause表示暂停
+     */
+    private String status;
+    private String startTime;
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 当前办理用户名称
+     */
+    private String userName;
+
+    public String getPreNodeName() {
+        return preNodeName;
+    }
+
+    public void setPreNodeName(String preNodeName) {
+        this.preNodeName = preNodeName;
+    }
+
+    public Date getNodeEndTime() {
+        return nodeEndTime;
+    }
+
+    public void setNodeEndTime(Date nodeEndTime) {
+        this.nodeEndTime = nodeEndTime;
+    }
+
+    public String getPreNodeId() {
+        return preNodeId;
+    }
+
+    public void setPreNodeId(String preNodeId) {
+        this.preNodeId = preNodeId;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getPreUserId() {
+        return preUserId;
+    }
+
+    public void setPreUserId(String preUserId) {
+        this.preUserId = preUserId;
+    }
+
+    public String getPreUserName() {
+        return preUserName;
+    }
+
+    public void setPreUserName(String preUserName) {
+        this.preUserName = preUserName;
+    }
+
+    public Integer getIsRead() {
+        return isRead;
+    }
+
+    public void setIsRead(Integer isRead) {
+        this.isRead = isRead;
+    }
+
+    public String getOrunId() {
+        return orunId;
+    }
+
+    public void setOrunId(String orunId) {
+        this.orunId = orunId;
+    }
+
+    public String getNodeId() {
+        return nodeId;
+    }
+
+    public void setNodeId(String nodeId) {
+        this.nodeId = nodeId;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getMobileUrl() {
+        return mobileUrl;
+    }
+
+    public void setMobileUrl(String mobileUrl) {
+        this.mobileUrl = mobileUrl;
+    }
+
+    public String getNodeName() {
+        return nodeName;
+    }
+
+    public void setNodeName(String nodeName) {
+        this.nodeName = nodeName;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+}

+ 13 - 0
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/contant/SystemConstant.java

@@ -20,10 +20,23 @@ import java.util.UUID;
  */
 public class SystemConstant {
 
+    /**
+     * 广药mq请求参数
+     */
+    public static final String GDPU_APP_ID = "3E5E377838002556";
+    public static final String GDPU_APP_SECRET = "aa7ba8bfc8a14e15a886a2492e66cbdd";
+    public static final String GDPU_SYS_APP_ID = "sysAppId";
+    public static final String GDPU_DOCUN_ID = "docunId";
+    public static final String GDPU_HEADER_APP_ID = "appid";
+    public static final String GDPU_HEADER_APP_SECRET = "secret";
+    public static final String GDPU_MQ_PUSH_URL = "https://portal.gdpu.edu.cn/mq/todotask/send";
+
+
     /**
      * api前缀
      */
     public static final String PREFIX_URL_OPEN = "/open";
+    public static final String PREFIX_URL_GDPU = "/admin/gdpu/affair";
 
     /**
      * 系统常量

+ 34 - 0
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/util/HttpUtil.java

@@ -255,4 +255,38 @@ public class HttpUtil {
         }
         return file;
     }
+
+    /**
+     * post 广药请求
+     *
+     * @param url
+     * @param params
+     * @param appid
+     * @param secret
+     * @param timestamp
+     * @return
+     */
+    public static String postGdpu(String url, Map<String, Object> params, String appid, String secret, Long timestamp) throws IOException {
+        // 构建post请求
+        HttpPost post = new HttpPost(url);
+        post.setHeader(SystemConstant.GDPU_HEADER_APP_ID, appid);
+        post.setHeader(SystemConstant.GDPU_HEADER_APP_SECRET, secret);
+        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded;charset=utf-8");
+        // 构建请求参数
+        List<BasicNameValuePair> pairs = new ArrayList<BasicNameValuePair>();
+        if (params != null) {
+            for (String key : params.keySet()) {
+                pairs.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
+            }
+        }
+        HttpEntity entity = null;
+        try {
+            entity = new UrlEncodedFormEntity(pairs, SystemConstant.CHARSET_NAME);
+        } catch (UnsupportedEncodingException e) {
+            log.error(SystemConstant.LOG_ERROR, e);
+        }
+        post.setEntity(entity);
+        // 执行请求,获取响应
+        return getRespString(post);
+    }
 }