From 5ca5e781a66e88c9adeb0dfd8772aeb44061df14 Mon Sep 17 00:00:00 2001 From: liuliang <401809302@qq.com> Date: Mon, 3 Apr 2023 13:37:06 +0800 Subject: [PATCH 1/2] liuliang --- .../dito/sendtodo/SendPortalTodoUtil.java | 115 ++++++++++-------- .../sendtodo/SendPortalWithAddTodoCmd.java | 2 +- 2 files changed, 64 insertions(+), 53 deletions(-) diff --git a/src/com/customization/dito/sendtodo/SendPortalTodoUtil.java b/src/com/customization/dito/sendtodo/SendPortalTodoUtil.java index f7f55d3d..b84e9e02 100644 --- a/src/com/customization/dito/sendtodo/SendPortalTodoUtil.java +++ b/src/com/customization/dito/sendtodo/SendPortalTodoUtil.java @@ -153,32 +153,34 @@ public class SendPortalTodoUtil { // String username = "admin"; // String passwd = "Uportal_123"; // String todourl = "http://172.16.25.133/portal-web/centerTodo/sync" ; - String auth = username + ":" + passwd; - String msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth); - bb.writeLog("msgdata:"+msgdata); - if(StringUtils.isNotEmpty(msgdata)){ - JSONObject msgObject = JSONObject.parseObject(msgdata); - //{"resultCode":"1","resultMsg":"No Result"} - if(msgObject.containsKey("resultCode")){ - String resultCode = msgObject.getString("resultCode"); - if("0".equals(resultCode)){ - - bb.writeLog("emailArray:"+emailArray); - if(StringUtils.isNotEmpty(emailArray)) - { - - Map templateMap = getEmailTemplate(requestname,lastname,processTime); - String notificationSubject = templateMap.get("notificationSubject"); - String notificationContent = templateMap.get("notificationContent"); - - sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent); + if (taskObjectList.size() > 0){ + String auth = username + ":" + passwd; + String msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth); + bb.writeLog("msgdata:"+msgdata); + if(StringUtils.isNotEmpty(msgdata)){ + JSONObject msgObject = JSONObject.parseObject(msgdata); + //{"resultCode":"1","resultMsg":"No Result"} + if(msgObject.containsKey("resultCode")){ + String resultCode = msgObject.getString("resultCode"); + if("0".equals(resultCode)){ + + bb.writeLog("emailArray:"+emailArray); + if(StringUtils.isNotEmpty(emailArray)) + { + + Map templateMap = getEmailTemplate(requestname,lastname,processTime); + String notificationSubject = templateMap.get("notificationSubject"); + String notificationContent = templateMap.get("notificationContent"); + + sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent); + } + + sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,nodeName,userids,requestObject.toJSONString(),resultCode,""); + + }else{ + String resultmsg = msgObject.getString("resultMsg"); + sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,nodeName,userids,requestObject.toJSONString(),resultCode,resultmsg); } - - sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,nodeName,userids,requestObject.toJSONString(),resultCode,""); - - }else{ - String resultmsg = msgObject.getString("resultMsg"); - sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,nodeName,userids,requestObject.toJSONString(),resultCode,resultmsg); } } } @@ -337,36 +339,37 @@ public class SendPortalTodoUtil { } } - requestObject.put("taskObjectList",taskObjectList); + if (taskObjectList.size() > 0){ + requestObject.put("taskObjectList",taskObjectList); - String auth = username + ":" + passwd; -// bb.writeLog("sendTodoDataByCreater-requestObject:"+requestObject.toJSONString()); - String msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth); - bb.writeLog("sendTodoDataByCreater-msgdata:"+msgdata); - if(!"".equals(msgdata)){ - JSONObject msgObject = JSONObject.parseObject(msgdata); - //{"resultCode":"1","resultMsg":"No Result"} - if(msgObject.containsKey("resultCode")){ - String resultCode = msgObject.getString("resultCode"); - if("0".equals(resultCode)){ - bb.writeLog("emailArray:"+emailArray); - if(StringUtils.isNotEmpty(emailArray)) - { + String auth = username + ":" + passwd; + String msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth); + bb.writeLog("sendTodoDataByCreater-msgdata:"+msgdata); + if(!"".equals(msgdata)){ + JSONObject msgObject = JSONObject.parseObject(msgdata); + //{"resultCode":"1","resultMsg":"No Result"} + if(msgObject.containsKey("resultCode")){ + String resultCode = msgObject.getString("resultCode"); + if("0".equals(resultCode)){ + bb.writeLog("emailArray:"+emailArray); + if(StringUtils.isNotEmpty(emailArray)) + { // String notificationSubject = "You have a new to-do list:"+requestname+",Please handle it in time"; // String notificationContent = "You have a new to-do list:"+requestname+",Please handle it in time"; - Map templateMap = getEmailTemplate(requestname,lastname,processTime); - String notificationSubject = templateMap.get("notificationSubject"); - String notificationContent = templateMap.get("notificationContent"); + Map templateMap = getEmailTemplate(requestname,lastname,processTime); + String notificationSubject = templateMap.get("notificationSubject"); + String notificationContent = templateMap.get("notificationContent"); - sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent); - } + sendMailUtil.sendMail(requestid,emailArray,notificationSubject,notificationContent); + } - sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,nodeName,userids,requestObject.toJSONString(),resultCode,""); + sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,nodeName,userids,requestObject.toJSONString(),resultCode,""); - }else{ - String resultmsg = msgObject.getString("resultMsg"); - sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,nodeName,userids,requestObject.toJSONString(),resultCode,resultmsg); + }else{ + String resultmsg = msgObject.getString("resultMsg"); + sendPortalErrorUtil.doRecordPortalErrorInfo(requestid,nodeId,nodeName,userids,requestObject.toJSONString(),resultCode,resultmsg); + } } } } @@ -397,6 +400,7 @@ public class SendPortalTodoUtil { String cus_staff = PropBean.getUfPropValue("cus_staff") ; String scopeid = "-1"; String scope = "HrmCustomFieldByInfoType" ; + String msgdata = ""; String terminal = "1" ; String taskType = "0"; @@ -532,6 +536,12 @@ public class SendPortalTodoUtil { userids = user.getUID()+""; + if (taskObjectList.size() > 0){ + String auth = username + ":" + passwd; + //bb.writeLog("requestObject:"+requestObject.toJSONString()); + msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth); + } + }else{ String actionType = "2" ; String objectAction = "0" ; @@ -651,11 +661,12 @@ public class SendPortalTodoUtil { } } requestObject.put("taskObjectList",taskObjectList); + // if (taskObjectList.size() > 0){ + String auth = username + ":" + passwd; + //bb.writeLog("requestObject:"+requestObject.toJSONString()); + msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth); + // } } - - String auth = username + ":" + passwd; - //bb.writeLog("requestObject:"+requestObject.toJSONString()); - String msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth); bb.writeLog("msgdata:"+msgdata); if(!"".equals(msgdata)){ JSONObject msgObject = JSONObject.parseObject(msgdata); diff --git a/src/com/customization/dito/sendtodo/SendPortalWithAddTodoCmd.java b/src/com/customization/dito/sendtodo/SendPortalWithAddTodoCmd.java index 17a0cc1b..49506b92 100644 --- a/src/com/customization/dito/sendtodo/SendPortalWithAddTodoCmd.java +++ b/src/com/customization/dito/sendtodo/SendPortalWithAddTodoCmd.java @@ -77,7 +77,7 @@ public class SendPortalWithAddTodoCmd { String terminal = "1" ; String taskType = "0"; - String actionType = "0" ; + String actionType = "2" ; String objectAction = "0" ; String objectType = "0"; From 13e630f450cb67336206b1804c69c55e76e7f61d Mon Sep 17 00:00:00 2001 From: zhangming <965499528@qq.com> Date: Mon, 3 Apr 2023 13:58:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=97=B6=E7=AD=BE=E7=AB=A0=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../signature/GetDocSignatureWebAction.java | 7 +++ .../signature/GetDocSignatureWebAction.java | 50 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/com/api/signature/GetDocSignatureWebAction.java create mode 100644 src/com/engine/signature/GetDocSignatureWebAction.java diff --git a/src/com/api/signature/GetDocSignatureWebAction.java b/src/com/api/signature/GetDocSignatureWebAction.java new file mode 100644 index 00000000..7dc462b0 --- /dev/null +++ b/src/com/api/signature/GetDocSignatureWebAction.java @@ -0,0 +1,7 @@ +package com.api.signature; + +import javax.ws.rs.Path; + +@Path("/docSign") +public class GetDocSignatureWebAction extends com.engine.haojing.web.GetDocSignatureWebAction { +} diff --git a/src/com/engine/signature/GetDocSignatureWebAction.java b/src/com/engine/signature/GetDocSignatureWebAction.java new file mode 100644 index 00000000..55c63b5d --- /dev/null +++ b/src/com/engine/signature/GetDocSignatureWebAction.java @@ -0,0 +1,50 @@ +package com.engine.signature; + +import com.alibaba.fastjson.JSON; +import weaver.conn.RecordSet; +import weaver.general.Util; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetDocSignatureWebAction { + + @GET + @Path("/list") + @Produces(MediaType.TEXT_PLAIN) + public String getDocSignatureByUserId(@Context HttpServletRequest request, @Context HttpServletResponse response) { + Map apidatas = new HashMap<>(); + try { + User user = HrmUserVarify.getUser (request , response); + RecordSet rs = new RecordSet(); + String sql = "SELECT a.markName, b.imagefileid, b.imagefilename FROM DocSignature a, ImageFile b where a.imagefileid = b.imagefileid " + + "and a.hrmresid = " + user.getUID(); + rs.execute(sql); + List> dataList = new ArrayList<>(); + if (rs.next()) { + Map data = new HashMap<>(); + data.put("markName", Util.null2String(rs.getString("markName"))); + data.put("imagefileid", Util.null2String(rs.getString("imagefileid"))); + data.put("imagefilename", Util.null2String(rs.getString("imagefilename"))); + dataList.add(data); + } + apidatas.put("api_status", true); + apidatas.put("counts", dataList.size()); + apidatas.put("datas", dataList); + } catch (Exception e) { + apidatas.put("api_status", false); + } + return JSON.toJSONString(apidatas); + } +}