#EC_HJ158# 最新的代码
parent
ce3ab7e749
commit
816f0c3fa2
@ -0,0 +1,30 @@
|
||||
package weaver.interfaces.dito.action;
|
||||
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.dito.card.SendRequestToCardUtil;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
*/
|
||||
public class SendRequest2CardAction implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
// String requestid = Util.null2String(requestInfo.getRequestManager().getRequestid());
|
||||
//
|
||||
// User user = requestInfo.getRequestManager().getUser();
|
||||
// String nodeid = requestInfo.getRequestManager().getNodeid()+"";
|
||||
// String workflowId = requestInfo.getRequestManager().getWorkflowid()+"";
|
||||
//
|
||||
// SendRequestToCardUtil sendRequestToCardUtil = new SendRequestToCardUtil();
|
||||
// sendRequestToCardUtil.sendRequestAtToCard(requestid,user, nodeid,workflowId);
|
||||
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,593 @@
|
||||
package weaver.interfaces.dito.card;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.customization.wfTodoCard.CardInfo;
|
||||
import com.customization.wfTodoCard.ContentInfo;
|
||||
import com.customization.wfTodoCard.TitleInfo;
|
||||
import com.customization.wfTodoCard.ViewDetail;
|
||||
import com.customization.wfTodoCard.service.CheckSendCardService;
|
||||
import com.customization.wfTodoCard.service.TodoCardService;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class SendRemarkToCardUtil {
|
||||
|
||||
String oaAuthKey = new BaseBean().getPropValue("workflowTodoCard", "oaAuthKey");
|
||||
|
||||
public void sendRequestRemarkToCard(String requestId, String workflowId, String remark, User user){
|
||||
SendRequestToCardUtil sendRequestToCardUtil = new SendRequestToCardUtil();
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
try{
|
||||
|
||||
String isMessageRemind = "";
|
||||
String sql1 = "select id,WORKFLOWNAME, isMessageRemind,icon from workflow_base where id='" + workflowId + "'";
|
||||
bb.writeLog("sendRequestRemarkToCard-sql1:"+sql1);
|
||||
rs.executeQuery(sql1);
|
||||
if(rs.next()){
|
||||
isMessageRemind = rs.getString("isMessageRemind");
|
||||
}
|
||||
bb.writeLog("sendRequestRemarkToCard-isMessageRemind:"+isMessageRemind);
|
||||
|
||||
if("1".equals(isMessageRemind)){
|
||||
bb.writeLog("sendRequestRemarkToCard-remark:"+remark);
|
||||
List<String> result = new ArrayList<String>();
|
||||
String title = "";
|
||||
if(StringUtils.isNotBlank(remark)){
|
||||
Document doc = Jsoup.parse(remark);
|
||||
// 选择所有包含 atsome - uid 属性的元素
|
||||
Elements uidElements = doc.select("[atsome-uid]");
|
||||
Iterator<Element> uidIt = uidElements.iterator();
|
||||
while(uidIt.hasNext()) {
|
||||
Element element = uidIt.next();
|
||||
String atsomeUid = element.attr("atsome-uid");
|
||||
if(!result.contains(atsomeUid)){
|
||||
result.add(atsomeUid);
|
||||
}
|
||||
}
|
||||
|
||||
Elements pElements = doc.select("p");
|
||||
Iterator<Element> pIt = pElements.iterator();
|
||||
while(pIt.hasNext()) {
|
||||
Element element = pIt.next();
|
||||
title += element.text();
|
||||
}
|
||||
}
|
||||
bb.writeLog("sendRequestRemarkToCard-title1:"+title);
|
||||
if(StringUtils.isNotBlank(title)){
|
||||
title = StringEscapeUtils.unescapeHtml4(title);
|
||||
}
|
||||
bb.writeLog("sendRequestRemarkToCard-title2:"+title);
|
||||
if(result.size() > 0){
|
||||
for(int i= 0;i<result.size();i++){
|
||||
String receiverId = result.get(i);
|
||||
bb.writeLog("sendRequestRemarkToCard-receiverId:"+receiverId);
|
||||
if(org.apache.commons.lang3.StringUtils.isNotBlank(receiverId)){
|
||||
String lastname = "";
|
||||
String sql = "select lastname,workcode,systemlanguage from hrmresource where id=?" ;
|
||||
bb.writeLog("sendRequestRemarkToCard-sql:"+sql);
|
||||
rs.executeQuery(sql, new Object[] { receiverId });
|
||||
if (rs.next()){
|
||||
lastname = rs.getString("lastname");
|
||||
}
|
||||
if(StringUtils.isNotBlank(lastname)){
|
||||
title = title.replace(lastname,lastname+" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
bb.writeLog("sendRequestRemarkToCard-title2:"+title);
|
||||
for(int i= 0;i<result.size();i++){
|
||||
String receiverId = result.get(i);
|
||||
bb.writeLog("sendRequestRemarkToCard-receiverId:"+receiverId);
|
||||
if(StringUtils.isNotBlank(receiverId)){
|
||||
String systemlanguage = "";
|
||||
String workcode = "";
|
||||
String sql = "select lastname,workcode,systemlanguage from hrmresource where id=?" ;
|
||||
bb.writeLog("sendRequestRemarkToCard-sql:"+sql);
|
||||
rs.executeQuery(sql, new Object[] { receiverId });
|
||||
if (rs.next()){
|
||||
systemlanguage = rs.getString("systemlanguage");
|
||||
workcode = rs.getString("workcode");
|
||||
}
|
||||
|
||||
bb.writeLog("sendRequestRemarkToCard-systemlanguage:"+systemlanguage);
|
||||
bb.writeLog("sendRequestRemarkToCard-workcode:"+workcode);
|
||||
|
||||
new CheckSendCardService().sendShareCard(""+user.getUID(), receiverId, requestId,"",title,"");
|
||||
|
||||
|
||||
//sendDefaultByCmd(workflowId,requestId,receiverId, "1", systemlanguage,workcode,title);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendDefaultByCmd(String workflowId, String requestId, String receiverId, String logintype, String language,String workcode,String expandMsg) {
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rd = new RecordSet();
|
||||
bb.writeLog("sendDefaultByCmd-default >>>>>");
|
||||
|
||||
String icon = "";
|
||||
String isMessageRemind = "";
|
||||
String sql1 = "select id,WORKFLOWNAME, isMessageRemind,icon from workflow_base where id='" + workflowId + "'";
|
||||
bb.writeLog("sendDefaultByCmd-sql1:"+sql1);
|
||||
rd.executeQuery(sql1);
|
||||
if(rd.next()){
|
||||
icon = rd.getString("icon");
|
||||
isMessageRemind = rd.getString("isMessageRemind");
|
||||
}
|
||||
|
||||
bb.writeLog("sendDefaultByCmd-icon:"+icon);
|
||||
bb.writeLog("sendDefaultByCmd-isMessageRemind:"+isMessageRemind);
|
||||
|
||||
String requestName = "";
|
||||
String createDate = "";
|
||||
String createTime = "";
|
||||
if ("1".equals(isMessageRemind)) {
|
||||
rd.executeQuery("select WORKFLOWID, CREATER,REQUESTNAME, CREATETIME, CREATEDATE from workflow_requestbase where REQUESTID = '" + requestId + "'");
|
||||
if (rd.next()) {
|
||||
requestName = rd.getString("REQUESTNAME");
|
||||
createDate = rd.getString("CREATEDATE");
|
||||
createTime = rd.getString("CREATETIME");
|
||||
}
|
||||
}
|
||||
|
||||
bb.writeLog("sendDefaultByCmd-requestName:"+requestName);
|
||||
bb.writeLog("sendDefaultByCmd-createDate:"+createDate);
|
||||
bb.writeLog("sendDefaultByCmd-createTime:"+createTime);
|
||||
|
||||
JSONArray callAuth = new JSONArray();
|
||||
callAuth.add((new JSONObject())
|
||||
.fluentPut("name", "weaver_userid").fluentPut("value", receiverId));
|
||||
callAuth.add((new JSONObject())
|
||||
.fluentPut("name", "usertoken").fluentPut("value", oaAuthKey));
|
||||
callAuth.add((new JSONObject())
|
||||
.fluentPut("name", "weaver_usertype").fluentPut("value", logintype));
|
||||
callAuth.add((new JSONObject())
|
||||
.fluentPut("name", "weaver_userlanguage").fluentPut("value", language));
|
||||
|
||||
doAtSend(requestName, icon, null, workflowId,requestId,language,createDate,createTime,workcode,expandMsg);
|
||||
}
|
||||
|
||||
|
||||
// public void copySendNeedSubmit(String requestname,String requestid,String nodeid){
|
||||
// RecordSet rs = new RecordSet();
|
||||
//
|
||||
// String workflowId = "";
|
||||
// String userid = "";
|
||||
// String requestName = "";
|
||||
// String createtime = "";
|
||||
// String createdate = "";
|
||||
//
|
||||
// String sql = "select WORKFLOWID, CREATER,REQUESTNAME, CREATETIME, CREATEDATE from workflow_requestbase where REQUESTID = '" + requestid + "'";
|
||||
// rs.executeQuery(sql);
|
||||
// if(rs.next()){
|
||||
// workflowId = rs.getString("WORKFLOWID");
|
||||
// userid = rs.getString("CREATER");
|
||||
// requestName = rs.getString("REQUESTNAME");
|
||||
// createtime = rs.getString("CREATETIME");
|
||||
// createdate = rs.getString("CREATEDATE");
|
||||
// }
|
||||
//
|
||||
// String isMessageRemind = "";
|
||||
// String icon = "";
|
||||
// String messageRemindScope = "";
|
||||
// if(StringUtils.isNotBlank(workflowId)){
|
||||
// sql = "select id, WORKFLOWNAME, messageRemindScope, isMessageRemind,icon from workflow_base where id=?" ;
|
||||
// rs.executeQuery(sql, new Object[] { workflowId });
|
||||
// if(rs.next()){
|
||||
// isMessageRemind = rs.getString("isMessageRemind");
|
||||
// icon = rs.getString("icon");
|
||||
// messageRemindScope = rs.getString("messageRemindScope");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// String ifMr = "";
|
||||
// String mainid = "";
|
||||
// if("1".equals(isMessageRemind)){
|
||||
// sql = "select id, workflowid, nodeid, sfmr from uf_wftodocontent where workflowid =" + workflowId + " and nodeid =" + nodeid ;
|
||||
// rs.executeQuery(sql);
|
||||
// if (rs.next()) {
|
||||
// mainid = rs.getString("id");
|
||||
// ifMr = rs.getString("sfmr");
|
||||
// }
|
||||
// }else{
|
||||
// ifMr = "1";
|
||||
// }
|
||||
// if ("1".equals(ifMr)) {
|
||||
// sql = "select id from uf_wftodocontent where workflowid = '" + workflowId + "' and nodeid ='0'";
|
||||
// rs.executeQuery(sql);
|
||||
// if (rs.next()) {
|
||||
// mainid = rs.getString("id");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<String> filedNameList = new ArrayList<>();
|
||||
// sql = "select fieldname from uf_wftodocontent_dt1 where mainid = '" + mainid + "' and selected =1 order by sort asc" ;
|
||||
// rs.executeQuery(sql);
|
||||
// while (rs.next()) {
|
||||
// String fieldname = rs.getString("fieldname");
|
||||
// if (!fieldname.startsWith("sys_")){
|
||||
// filedNameList.add(fieldname);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// JSONArray callAuth = new JSONArray();
|
||||
// callAuth.add((new JSONObject())
|
||||
// .fluentPut("name", "weaver_userid").fluentPut("value", receiverId));
|
||||
// callAuth.add((new JSONObject())
|
||||
// .fluentPut("name", "usertoken").fluentPut("value", this.oaAuthKey));
|
||||
// callAuth.add((new JSONObject())
|
||||
// .fluentPut("name", "weaver_usertype").fluentPut("value", (logintype == null) ? "1" : logintype));
|
||||
// callAuth.add((new JSONObject())
|
||||
// .fluentPut("name", "weaver_userlanguage").fluentPut("value", language));
|
||||
// String callAuthStr = callAuth.toJSONString();
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
public void doAtSend(String requestname,String icon, List<String> fieldNameList,String workflowId,String requestId,String language,String CreateDate,String CreateTime,String WorkCode,String expandMsg){
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("doAtSend--requestname:"+requestname);
|
||||
bb.writeLog("doAtSend-expandMsg: " + expandMsg);
|
||||
JSONArray cardJsonArray = getCardParam(fieldNameList, requestname,workflowId,requestId,language);
|
||||
bb.writeLog("doAtSend-cardJsonArray:"+cardJsonArray.toJSONString());
|
||||
Map<String,String> sendUserMap = getRequestCreator(requestId);
|
||||
|
||||
cardJsonArray.add(
|
||||
new JSONObject().fluentPut("name", "Create Time").fluentPut("value", CreateDate + " " + CreateTime)
|
||||
);
|
||||
cardJsonArray.add(
|
||||
new JSONObject().fluentPut("name", "Creator").fluentPut("value", sendUserMap.get("name"))
|
||||
);
|
||||
String cardData = cardJsonArray.toJSONString();
|
||||
bb.writeLog("doAtSend-casrdifno :: " + cardData);
|
||||
|
||||
CardInfo cardInfo = baseCardInfo(requestname,"", icon, cardData, requestId);
|
||||
|
||||
if (StringUtils.isNotBlank(expandMsg)) {
|
||||
expandMsg = expandMsg.replace(" ", " ");
|
||||
bb.writeLog("doAtSend-expandMsg2: " + expandMsg);
|
||||
cardInfo.setExpandMsg(expandMsg);
|
||||
}
|
||||
|
||||
bb.writeLog("doAtSend-cardInfo :: " + cardInfo.toString());
|
||||
|
||||
String uid = UUID.randomUUID().toString();
|
||||
String message = TodoCardService.createTodoCard(sendUserMap.get("code"),WorkCode, 1, uid, cardInfo);
|
||||
bb.writeLog("doAtSend-message:"+message);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public CardInfo baseCardInfo(String requestName,String color, String icon, String cardData, String requestid){
|
||||
RecordSet recordSet = new RecordSet();
|
||||
|
||||
// 卡片标题替换成流程标题
|
||||
recordSet.executeQuery("select a.WORKFLOWNAME from workflow_base a left join workflow_requestbase b on a.id=b.WORKFLOWID where b.REQUESTID ="+requestid);
|
||||
if (recordSet.next()){
|
||||
requestName = Util.null2String(recordSet.getString("WORKFLOWNAME"));
|
||||
}
|
||||
|
||||
TitleInfo titleInfo = new TitleInfo();
|
||||
titleInfo.setName(requestName);
|
||||
titleInfo.setColor(null==color || "".equals(color)?"#F4F5F7":color);
|
||||
titleInfo.setIconName(icon);
|
||||
|
||||
CardInfo cardInfo = new CardInfo();
|
||||
cardInfo.setTitleInfo(titleInfo);
|
||||
|
||||
ContentInfo contentInfo = new ContentInfo();
|
||||
contentInfo.setType("keyInfo");
|
||||
contentInfo.setOrder(1);
|
||||
contentInfo.setData(cardData);
|
||||
List<ContentInfo> contentInfos = new ArrayList<>();
|
||||
contentInfos.add(contentInfo);
|
||||
cardInfo.setContentInfos(contentInfos);
|
||||
|
||||
recordSet.executeQuery("select pcxqdz, appxqdz from uf_cardifno_conf"); // 配置跳转地址
|
||||
if (recordSet.next()){
|
||||
ViewDetail viewDetail = new ViewDetail();
|
||||
String detailPcUrl = Util.null2String(recordSet.getString("pcxqdz"));
|
||||
String detailAppUrl = Util.null2String(recordSet.getString("appxqdz"));
|
||||
if (!"".equals(detailPcUrl)){
|
||||
viewDetail.setPcUrl(detailPcUrl + requestid);
|
||||
}
|
||||
if (!"".equals(detailAppUrl)){
|
||||
viewDetail.setAppUrl(detailAppUrl + requestid);
|
||||
}
|
||||
viewDetail.setOpenMethod("H5");
|
||||
|
||||
cardInfo.setViewDetailInfo(viewDetail);
|
||||
}
|
||||
|
||||
return cardInfo;
|
||||
}
|
||||
|
||||
|
||||
private Map<String, String> getRequestCreator(String requestid) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery("select h.LASTNAME, h.WORKCODE from workflow_requestbase a left join hrmresource h on h.id=a.CREATER where a.requestid = " + requestid, new Object[0]);
|
||||
if (recordSet.next()) {
|
||||
map.put("name", recordSet.getString("LASTNAME"));
|
||||
map.put("code", recordSet.getString("WORKCODE"));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
// 卡片通用参数
|
||||
private JSONArray getCardParam(List<String> filedNameList,String requestName,String workflowId,String requestId,String language){
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog(">>>> get param :"+requestName);
|
||||
JSONArray cardJsonArray = new JSONArray();
|
||||
cardJsonArray.add(
|
||||
new JSONObject().fluentPut("name", "Title").fluentPut("value", requestName)
|
||||
);
|
||||
|
||||
// 参数存储
|
||||
Map<String, String> paramMap = new HashMap<>();
|
||||
RecordSet rd = new RecordSet();
|
||||
Integer billid=0; // 表单id
|
||||
if (null != filedNameList && filedNameList.size() > 0) {
|
||||
|
||||
String queryTablesql = "select TABLENAME,b.id billid from workflow_base a inner join workflow_bill b on a.FORMID =b.ID where a.id = '" + workflowId+ "'";
|
||||
rd.executeQuery(queryTablesql);
|
||||
String tablename = "";
|
||||
if (rd.next()) {
|
||||
tablename = rd.getString("TABLENAME");
|
||||
billid = rd.getInt("billid");
|
||||
|
||||
String selectSql = String.join(",", filedNameList);
|
||||
String querySql = "select " + selectSql + " from " + tablename + " where requestid = '" + requestId + "'";
|
||||
rd.executeQuery(querySql);
|
||||
if (rd.next()) {
|
||||
for (String tempname : filedNameList) {
|
||||
paramMap.put(tempname, Util.null2String(rd.getString(tempname)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String sqlSelectLabel="select wb.FIELDNAME, hb.LABELNAME " +
|
||||
"from workflow_billfield wb left join htmllabelinfo hb on hb.INDEXID = wb.FIELDLABEL " +
|
||||
"where wb.BILLID = ? and hb.languageid=?";
|
||||
|
||||
RecordSet queryLabel=new RecordSet();
|
||||
queryLabel.executeQuery(sqlSelectLabel,billid, language);
|
||||
|
||||
Map<String,String> labelMap = new HashMap<>();
|
||||
while (queryLabel.next()){
|
||||
String fieldname = queryLabel.getString("FIELDNAME");
|
||||
String labelname = queryLabel.getString("LABELNAME");
|
||||
labelMap.put(fieldname,labelname);
|
||||
}
|
||||
|
||||
Map<String,Map<String,String>> selectItemMap = mapSelectItem(billid); // 选择框选项
|
||||
Map<String,String> liulanMap = mapLiuLan(billid); // 浏览按钮
|
||||
Map<String,String> commonLiuLanMap = mapCommonLiuLan(billid); // 浏览按钮
|
||||
Set<String> checkSet = getCheckFieldName(billid); // check字段
|
||||
Set<String> fileFieldSet = getFileFieldSet(billid); // 文件字段
|
||||
|
||||
bb.writeLog("》》》 select item >> "+ JSON.toJSONString(selectItemMap));
|
||||
bb.writeLog("》》》 liulanMap >> "+ JSON.toJSONString(liulanMap));
|
||||
|
||||
for (String tempname : filedNameList) {
|
||||
String labelName = labelMap.getOrDefault(tempname,tempname);
|
||||
String value = paramMap.getOrDefault(tempname, "");
|
||||
if (!"".equals(value)){
|
||||
bb.writeLog(">>> for tempname >> "+tempname);
|
||||
|
||||
if (selectItemMap.containsKey(tempname)){ // 选择框
|
||||
bb.writeLog("select item >> "+tempname+" >> "+value);
|
||||
Map<String,String> selectItem = selectItemMap.get(tempname);
|
||||
String [] valueArray = value.split(",");
|
||||
List<String> valueList = new ArrayList<>();
|
||||
for (String tempValue : valueArray){
|
||||
String tempValueName = selectItem.getOrDefault(tempValue,tempValue);
|
||||
valueList.add(tempValueName);
|
||||
}
|
||||
bb.writeLog("> select item >> "+tempname+" >> "+valueList);
|
||||
value = String.join(", ",valueList);
|
||||
|
||||
} else if (checkSet.contains(tempname)){ // check字段
|
||||
bb.writeLog("checkSet >> "+tempname+" >> "+value);
|
||||
value= "1".equals(value) ? "Yes" : "No";
|
||||
|
||||
} else if (fileFieldSet.contains(tempname)){ // 附件字段
|
||||
bb.writeLog("fileFieldSet >> "+tempname+" >> "+value);
|
||||
List<String> fileList = new ArrayList<>();
|
||||
RecordSet queryTemp = new RecordSet();
|
||||
queryTemp.executeQuery("select IMAGEFILENAME from docimagefile where docid in ("+value+")");
|
||||
while (queryTemp.next()){
|
||||
String tempValueName = queryTemp.getString("IMAGEFILENAME");
|
||||
fileList.add(tempValueName);
|
||||
}
|
||||
value = String.join(", ",fileList);
|
||||
|
||||
} else if (liulanMap.containsKey(tempname)){ //自定义浏览框
|
||||
String searchById = liulanMap.get(tempname);
|
||||
bb.writeLog("liulanMap >> "+tempname+" >> "+searchById);
|
||||
String [] valueArray = value.split(",");
|
||||
List<String> valueList = new ArrayList<>();
|
||||
RecordSet queryTemp = new RecordSet();
|
||||
|
||||
for (String tempValue : valueArray){
|
||||
bb.writeLog("liulanMap >> "+tempname+" >> "+searchById+" >> "+tempValue);
|
||||
queryTemp.executeQuery(searchById,tempValue);
|
||||
if (queryTemp.next()){
|
||||
String tempValueName = queryTemp.getString(1);
|
||||
bb.writeLog("query reuslt ");
|
||||
valueList.add(tempValueName);
|
||||
}else {
|
||||
bb.writeLog("query reuslt null");
|
||||
}
|
||||
}
|
||||
value = String.join(", ",valueList);
|
||||
|
||||
} else if (commonLiuLanMap.containsKey(tempname)){ // 公共浏览框类型
|
||||
String fieldType = commonLiuLanMap.get(tempname);
|
||||
bb.writeLog("commonLiuLanMap >> "+tempname+" >> "+fieldType + " >>value= "+value);
|
||||
|
||||
RecordSet queryTemp = new RecordSet();
|
||||
|
||||
switch (fieldType){
|
||||
case "1": // 单选人力
|
||||
queryTemp.executeQuery("select LASTNAME from hrmresource h where id =?",value);
|
||||
if (queryTemp.next()){
|
||||
value = Util.null2String(queryTemp.getString("LASTNAME"));
|
||||
}
|
||||
break;
|
||||
|
||||
case "17": // 多选人力
|
||||
queryTemp.executeQuery("select LASTNAME from hrmresource h where id in ("+value+")");
|
||||
List<String> valueList = new ArrayList<>();
|
||||
while (queryTemp.next()){
|
||||
valueList.add(Util.null2String(queryTemp.getString("LASTNAME")));
|
||||
}
|
||||
bb.writeLog("user list >> "+ JSON.toJSONString(valueList));
|
||||
value = String.join(", ",valueList);
|
||||
break;
|
||||
|
||||
case "4": // 单选部门
|
||||
queryTemp.executeQuery("select DEPARTMENTNAME from hrmdepartment where id=?",value);
|
||||
if (queryTemp.next()){
|
||||
value = Util.null2String(queryTemp.getString("DEPARTMENTNAME"));
|
||||
}
|
||||
break;
|
||||
|
||||
case "57": // 多选部门
|
||||
queryTemp.executeQuery("select DEPARTMENTNAME from hrmdepartment where id in ("+value+")");
|
||||
List<String> valueList2 = new ArrayList<>();
|
||||
while (queryTemp.next()){
|
||||
valueList2.add(Util.null2String(queryTemp.getString("DEPARTMENTNAME")));
|
||||
}
|
||||
bb.writeLog("dep lis is >> "+ JSON.toJSONString(valueList2));
|
||||
value = String.join(", ",valueList2);
|
||||
break;
|
||||
|
||||
case "16": // 单选流程
|
||||
queryTemp.executeQuery("select REQUESTNAME from workflow_requestbase where REQUESTID =?",value);
|
||||
if (queryTemp.next()){
|
||||
value = Util.null2String(queryTemp.getString("REQUESTNAME"));
|
||||
}
|
||||
break;
|
||||
|
||||
case "152": // 多选流程
|
||||
queryTemp.executeQuery("select REQUESTNAME from workflow_requestbase where REQUESTID in ("+value+")");
|
||||
List<String> valueList3 = new ArrayList<>();
|
||||
while (queryTemp.next()){
|
||||
valueList3.add(Util.null2String(queryTemp.getString("REQUESTNAME")));
|
||||
}
|
||||
bb.writeLog("request list >> "+ JSON.toJSONString(valueList3));
|
||||
value = String.join(", ",valueList3);
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
value = value.replace(" ", " ");
|
||||
value = value.replace("<br>", " ");
|
||||
}
|
||||
}
|
||||
cardJsonArray.add(
|
||||
new JSONObject().fluentPut("name", labelName).fluentPut("value", value)
|
||||
);
|
||||
}
|
||||
}
|
||||
return cardJsonArray;
|
||||
}
|
||||
|
||||
|
||||
// 选择框选项数据
|
||||
private Map<String,Map<String,String>> mapSelectItem(Integer billid){
|
||||
RecordSet query = new RecordSet();
|
||||
query.executeQuery("select a.FIELDNAME , b.SELECTVALUE , b.SELECTNAME from workflow_billfield a left join workflow_selectitem b on a.id=b.FIELDID where a.billid=? and a.fieldhtmltype=5 order by a.id",billid);
|
||||
Map<String,Map<String,String>> map = new HashMap<>();
|
||||
while (query.next()){
|
||||
String fieldname = query.getString("FIELDNAME");
|
||||
String selectvalue = query.getString("SELECTVALUE");
|
||||
String selectname = query.getString("SELECTNAME");
|
||||
if (map.containsKey(fieldname)){
|
||||
map.get(fieldname).put(selectvalue,selectname);
|
||||
}else{
|
||||
Map<String,String> tempMap = new HashMap<>();
|
||||
tempMap.put(selectvalue,selectname);
|
||||
map.put(fieldname,tempMap);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// 勾选框字段名
|
||||
private Set<String> getCheckFieldName(Integer billid){
|
||||
Set<String> set = new HashSet<>();
|
||||
RecordSet query = new RecordSet();
|
||||
query.executeQuery("select FIELDNAME from workflow_billfield where BILLID =? and FIELDHTMLTYPE=4",billid);
|
||||
while (query.next()){
|
||||
set.add(query.getString("FIELDNAME"));
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
// 附件选择
|
||||
private Set<String> getFileFieldSet(Integer billid){
|
||||
Set<String> set = new HashSet<>();
|
||||
RecordSet query = new RecordSet();
|
||||
query.executeQuery("select FIELDNAME from workflow_billfield where BILLID =? and FIELDHTMLTYPE=6",billid);
|
||||
while (query.next()){
|
||||
set.add(query.getString("FIELDNAME"));
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
// 浏览按钮
|
||||
private Map<String,String> mapLiuLan(Integer billid){
|
||||
RecordSet query = new RecordSet();
|
||||
Map<String,String> map = new HashMap<>();
|
||||
query.executeQuery("select FIELDNAME, FIELDDBTYPE from workflow_billfield where BILLID =? and FIELDDBTYPE like 'browser.%'",billid);
|
||||
while (query.next()){
|
||||
String fieldname = query.getString("FIELDNAME");
|
||||
String fielddbtpye = query.getString("FIELDDBTYPE");
|
||||
String showname = fielddbtpye.substring(8);
|
||||
RecordSet query2 = new RecordSet();
|
||||
query2.executeQuery("select searchById from mode_browser where showname =?",showname);
|
||||
if (query2.next()){
|
||||
String searchById = query2.getString("searchById");
|
||||
map.put(fieldname,searchById);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// 公共浏览框类型
|
||||
private Map<String,String> mapCommonLiuLan(Integer billid){
|
||||
Map<String,String> map = new HashMap<>();
|
||||
RecordSet query = new RecordSet();
|
||||
query.executeQuery("select FIELDNAME, type from workflow_billfield wb where FIELDHTMLTYPE=3 and BILLID = ?",billid);
|
||||
while (query.next()){
|
||||
String fieldname = query.getString("FIELDNAME");
|
||||
String fielddbtpye = query.getString("type");
|
||||
map.put(fieldname,fielddbtpye);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,564 @@
|
||||
package weaver.interfaces.dito.card;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.customization.wfTodoCard.*;
|
||||
import com.customization.wfTodoCard.service.CheckSendCardService;
|
||||
import com.customization.wfTodoCard.service.TodoCardService;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import java.util.*;
|
||||
|
||||
public class SendRequestToCardUtil {
|
||||
|
||||
String oaAuthKey = new BaseBean().getPropValue("workflowTodoCard", "oaAuthKey");
|
||||
|
||||
public void sendRequestAtToCard(String requestId, User user, String nodeid,String workflowId,String remark){
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
try{
|
||||
bb.writeLog("SendRequestToCardUtil-remark:"+remark);
|
||||
List<String> result = new ArrayList<String>();
|
||||
String title = "";
|
||||
if(StringUtils.isNotBlank(remark)){
|
||||
Document doc = Jsoup.parse(remark);
|
||||
// 选择所有包含 atsome - uid 属性的元素
|
||||
Elements uidElements = doc.select("[atsome-uid]");
|
||||
Iterator<Element> uidIt = uidElements.iterator();
|
||||
while(uidIt.hasNext()) {
|
||||
Element element = uidIt.next();
|
||||
String atsomeUid = element.attr("atsome-uid");
|
||||
if(!result.contains(atsomeUid)){
|
||||
result.add(atsomeUid);
|
||||
}
|
||||
}
|
||||
|
||||
Elements pElements = doc.select("p");
|
||||
Iterator<Element> pIt = pElements.iterator();
|
||||
while(pIt.hasNext()) {
|
||||
Element element = pIt.next();
|
||||
title += element.text();
|
||||
}
|
||||
}
|
||||
|
||||
bb.writeLog("SendRequestToCardUtil-title1:"+title);
|
||||
if(StringUtils.isNotBlank(title)){
|
||||
title = StringEscapeUtils.unescapeHtml4(title);
|
||||
}
|
||||
|
||||
bb.writeLog("SendRequestToCardUtil-title2:"+title);
|
||||
|
||||
if(result.size() > 0){
|
||||
for(int i= 0;i<result.size();i++){
|
||||
String receiverId = result.get(i);
|
||||
if(StringUtils.isNotBlank(receiverId)){
|
||||
String lastname = "";
|
||||
String sql = "select lastname,workcode,systemlanguage from hrmresource where id=?" ;
|
||||
rs.executeQuery(sql, new Object[] { receiverId });
|
||||
if (rs.next()){
|
||||
lastname = rs.getString("lastname");
|
||||
}
|
||||
if(StringUtils.isNotBlank(lastname)){
|
||||
title = title.replace(lastname,lastname+" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
bb.writeLog("SendRequestToCardUtil-title2:"+title);
|
||||
for(int i= 0;i<result.size();i++){
|
||||
String receiverId = result.get(i);
|
||||
if(StringUtils.isNotBlank(receiverId)){
|
||||
String systemlanguage = "";
|
||||
String workcode = "";
|
||||
String sql = "select lastname,workcode,systemlanguage from hrmresource where id=?" ;
|
||||
rs.executeQuery(sql, new Object[] { receiverId });
|
||||
if (rs.next()){
|
||||
systemlanguage = rs.getString("systemlanguage");
|
||||
workcode = rs.getString("workcode");
|
||||
}
|
||||
|
||||
new CheckSendCardService().sendShareCard(""+user.getUID(), receiverId, requestId,"",title,"You have been tagged in a comment.");
|
||||
|
||||
//sendDefault(workflowId,requestId,receiverId, "1", systemlanguage,workcode,title);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendDefault(String workflowId, String requestId, String receiverId, String logintype, String language,String workcode,String expandMsg) {
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rd = new RecordSet();
|
||||
bb.writeLog("sendRequestAtToCard-default >>>>>");
|
||||
|
||||
String icon = "";
|
||||
String sql1 = "select id,WORKFLOWNAME, isMessageRemind,icon from workflow_base where id='" + workflowId + "'";
|
||||
bb.writeLog("sendRequestAtToCard-sql1:"+sql1);
|
||||
rd.executeQuery(sql1);
|
||||
if(rd.next()){
|
||||
icon = rd.getString("icon");
|
||||
}
|
||||
|
||||
bb.writeLog("sendRequestAtToCard-icon:"+icon);
|
||||
|
||||
String requestName = "";
|
||||
String createDate = "";
|
||||
String createTime = "";
|
||||
rd.executeQuery("select WORKFLOWID, CREATER,REQUESTNAME, CREATETIME, CREATEDATE from workflow_requestbase where REQUESTID = '" + requestId + "'");
|
||||
if (rd.next()) {
|
||||
requestName = rd.getString("REQUESTNAME");
|
||||
createDate = rd.getString("CREATEDATE");
|
||||
createTime = rd.getString("CREATETIME");
|
||||
}
|
||||
|
||||
bb.writeLog("sendRequestAtToCard-requestName:"+requestName);
|
||||
bb.writeLog("sendRequestAtToCard-createDate:"+createDate);
|
||||
bb.writeLog("sendRequestAtToCard-createTime:"+createTime);
|
||||
|
||||
JSONArray callAuth = new JSONArray();
|
||||
callAuth.add((new JSONObject())
|
||||
.fluentPut("name", "weaver_userid").fluentPut("value", receiverId));
|
||||
callAuth.add((new JSONObject())
|
||||
.fluentPut("name", "usertoken").fluentPut("value", oaAuthKey));
|
||||
callAuth.add((new JSONObject())
|
||||
.fluentPut("name", "weaver_usertype").fluentPut("value", logintype));
|
||||
callAuth.add((new JSONObject())
|
||||
.fluentPut("name", "weaver_userlanguage").fluentPut("value", language));
|
||||
|
||||
doAtSend(requestName, icon, null, workflowId,requestId,language,createDate,createTime,workcode,expandMsg);
|
||||
}
|
||||
|
||||
|
||||
// public void copySendNeedSubmit(String requestname,String requestid,String nodeid){
|
||||
// RecordSet rs = new RecordSet();
|
||||
//
|
||||
// String workflowId = "";
|
||||
// String userid = "";
|
||||
// String requestName = "";
|
||||
// String createtime = "";
|
||||
// String createdate = "";
|
||||
//
|
||||
// String sql = "select WORKFLOWID, CREATER,REQUESTNAME, CREATETIME, CREATEDATE from workflow_requestbase where REQUESTID = '" + requestid + "'";
|
||||
// rs.executeQuery(sql);
|
||||
// if(rs.next()){
|
||||
// workflowId = rs.getString("WORKFLOWID");
|
||||
// userid = rs.getString("CREATER");
|
||||
// requestName = rs.getString("REQUESTNAME");
|
||||
// createtime = rs.getString("CREATETIME");
|
||||
// createdate = rs.getString("CREATEDATE");
|
||||
// }
|
||||
//
|
||||
// String isMessageRemind = "";
|
||||
// String icon = "";
|
||||
// String messageRemindScope = "";
|
||||
// if(StringUtils.isNotBlank(workflowId)){
|
||||
// sql = "select id, WORKFLOWNAME, messageRemindScope, isMessageRemind,icon from workflow_base where id=?" ;
|
||||
// rs.executeQuery(sql, new Object[] { workflowId });
|
||||
// if(rs.next()){
|
||||
// isMessageRemind = rs.getString("isMessageRemind");
|
||||
// icon = rs.getString("icon");
|
||||
// messageRemindScope = rs.getString("messageRemindScope");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// String ifMr = "";
|
||||
// String mainid = "";
|
||||
// if("1".equals(isMessageRemind)){
|
||||
// sql = "select id, workflowid, nodeid, sfmr from uf_wftodocontent where workflowid =" + workflowId + " and nodeid =" + nodeid ;
|
||||
// rs.executeQuery(sql);
|
||||
// if (rs.next()) {
|
||||
// mainid = rs.getString("id");
|
||||
// ifMr = rs.getString("sfmr");
|
||||
// }
|
||||
// }else{
|
||||
// ifMr = "1";
|
||||
// }
|
||||
// if ("1".equals(ifMr)) {
|
||||
// sql = "select id from uf_wftodocontent where workflowid = '" + workflowId + "' and nodeid ='0'";
|
||||
// rs.executeQuery(sql);
|
||||
// if (rs.next()) {
|
||||
// mainid = rs.getString("id");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<String> filedNameList = new ArrayList<>();
|
||||
// sql = "select fieldname from uf_wftodocontent_dt1 where mainid = '" + mainid + "' and selected =1 order by sort asc" ;
|
||||
// rs.executeQuery(sql);
|
||||
// while (rs.next()) {
|
||||
// String fieldname = rs.getString("fieldname");
|
||||
// if (!fieldname.startsWith("sys_")){
|
||||
// filedNameList.add(fieldname);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// JSONArray callAuth = new JSONArray();
|
||||
// callAuth.add((new JSONObject())
|
||||
// .fluentPut("name", "weaver_userid").fluentPut("value", receiverId));
|
||||
// callAuth.add((new JSONObject())
|
||||
// .fluentPut("name", "usertoken").fluentPut("value", this.oaAuthKey));
|
||||
// callAuth.add((new JSONObject())
|
||||
// .fluentPut("name", "weaver_usertype").fluentPut("value", (logintype == null) ? "1" : logintype));
|
||||
// callAuth.add((new JSONObject())
|
||||
// .fluentPut("name", "weaver_userlanguage").fluentPut("value", language));
|
||||
// String callAuthStr = callAuth.toJSONString();
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
public void doAtSend(String requestname,String icon, List<String> fieldNameList,String workflowId,String requestId,String language,String CreateDate,String CreateTime,String WorkCode,String expandMsg){
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("doAtSend--requestname:"+requestname);
|
||||
|
||||
JSONArray cardJsonArray = getCardParam(fieldNameList, requestname,workflowId,requestId,language);
|
||||
bb.writeLog("doAtSend-cardJsonArray:"+cardJsonArray.toJSONString());
|
||||
Map<String,String> sendUserMap = getRequestCreator(requestId);
|
||||
|
||||
cardJsonArray.add(
|
||||
new JSONObject().fluentPut("name", "Create Time").fluentPut("value", CreateDate + " " + CreateTime)
|
||||
);
|
||||
cardJsonArray.add(
|
||||
new JSONObject().fluentPut("name", "Creator").fluentPut("value", sendUserMap.get("name"))
|
||||
);
|
||||
String cardData = cardJsonArray.toJSONString();
|
||||
bb.writeLog("doAtSend casrdifno :: " + cardData);
|
||||
|
||||
CardInfo cardInfo = baseCardInfo(requestname,"", icon, cardData, requestId);
|
||||
|
||||
if (StringUtils.isNotBlank(expandMsg)) {
|
||||
expandMsg = expandMsg.replace(" ", " ");
|
||||
cardInfo.setExpandMsg(expandMsg);
|
||||
}
|
||||
|
||||
bb.writeLog("doAtSend cardInfo :: " + cardInfo.toString());
|
||||
|
||||
String uid = UUID.randomUUID().toString();
|
||||
String message = TodoCardService.createTodoCard(sendUserMap.get("code"),WorkCode, 1, uid, cardInfo);
|
||||
bb.writeLog("message:"+message);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public CardInfo baseCardInfo(String requestName,String color, String icon, String cardData, String requestid){
|
||||
RecordSet recordSet = new RecordSet();
|
||||
|
||||
// 卡片标题替换成流程标题
|
||||
recordSet.executeQuery("select a.WORKFLOWNAME from workflow_base a left join workflow_requestbase b on a.id=b.WORKFLOWID where b.REQUESTID ="+requestid);
|
||||
if (recordSet.next()){
|
||||
requestName = Util.null2String(recordSet.getString("WORKFLOWNAME"));
|
||||
}
|
||||
|
||||
TitleInfo titleInfo = new TitleInfo();
|
||||
titleInfo.setName(requestName);
|
||||
titleInfo.setColor(null==color || "".equals(color)?"#F4F5F7":color);
|
||||
titleInfo.setIconName(icon);
|
||||
|
||||
CardInfo cardInfo = new CardInfo();
|
||||
cardInfo.setTitleInfo(titleInfo);
|
||||
|
||||
ContentInfo contentInfo = new ContentInfo();
|
||||
contentInfo.setType("keyInfo");
|
||||
contentInfo.setOrder(1);
|
||||
contentInfo.setData(cardData);
|
||||
List<ContentInfo> contentInfos = new ArrayList<>();
|
||||
contentInfos.add(contentInfo);
|
||||
cardInfo.setContentInfos(contentInfos);
|
||||
|
||||
recordSet.executeQuery("select pcxqdz, appxqdz from uf_cardifno_conf"); // 配置跳转地址
|
||||
if (recordSet.next()){
|
||||
ViewDetail viewDetail = new ViewDetail();
|
||||
String detailPcUrl = Util.null2String(recordSet.getString("pcxqdz"));
|
||||
String detailAppUrl = Util.null2String(recordSet.getString("appxqdz"));
|
||||
if (!"".equals(detailPcUrl)){
|
||||
viewDetail.setPcUrl(detailPcUrl + requestid);
|
||||
}
|
||||
if (!"".equals(detailAppUrl)){
|
||||
viewDetail.setAppUrl(detailAppUrl + requestid);
|
||||
}
|
||||
viewDetail.setOpenMethod("H5");
|
||||
|
||||
cardInfo.setViewDetailInfo(viewDetail);
|
||||
}
|
||||
|
||||
return cardInfo;
|
||||
}
|
||||
|
||||
|
||||
private Map<String, String> getRequestCreator(String requestid) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery("select h.LASTNAME, h.WORKCODE from workflow_requestbase a left join hrmresource h on h.id=a.CREATER where a.requestid = " + requestid, new Object[0]);
|
||||
if (recordSet.next()) {
|
||||
map.put("name", recordSet.getString("LASTNAME"));
|
||||
map.put("code", recordSet.getString("WORKCODE"));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
// 卡片通用参数
|
||||
private JSONArray getCardParam(List<String> filedNameList,String requestName,String workflowId,String requestId,String language){
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog(">>>> get param :"+requestName);
|
||||
JSONArray cardJsonArray = new JSONArray();
|
||||
cardJsonArray.add(
|
||||
new JSONObject().fluentPut("name", "Title").fluentPut("value", requestName)
|
||||
);
|
||||
|
||||
// 参数存储
|
||||
Map<String, String> paramMap = new HashMap<>();
|
||||
RecordSet rd = new RecordSet();
|
||||
Integer billid=0; // 表单id
|
||||
if (null != filedNameList && filedNameList.size() > 0) {
|
||||
|
||||
String queryTablesql = "select TABLENAME,b.id billid from workflow_base a inner join workflow_bill b on a.FORMID =b.ID where a.id = '" + workflowId+ "'";
|
||||
rd.executeQuery(queryTablesql);
|
||||
String tablename = "";
|
||||
if (rd.next()) {
|
||||
tablename = rd.getString("TABLENAME");
|
||||
billid = rd.getInt("billid");
|
||||
|
||||
String selectSql = String.join(",", filedNameList);
|
||||
String querySql = "select " + selectSql + " from " + tablename + " where requestid = '" + requestId + "'";
|
||||
rd.executeQuery(querySql);
|
||||
if (rd.next()) {
|
||||
for (String tempname : filedNameList) {
|
||||
paramMap.put(tempname, Util.null2String(rd.getString(tempname)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String sqlSelectLabel="select wb.FIELDNAME, hb.LABELNAME " +
|
||||
"from workflow_billfield wb left join htmllabelinfo hb on hb.INDEXID = wb.FIELDLABEL " +
|
||||
"where wb.BILLID = ? and hb.languageid=?";
|
||||
|
||||
RecordSet queryLabel=new RecordSet();
|
||||
queryLabel.executeQuery(sqlSelectLabel,billid, language);
|
||||
|
||||
Map<String,String> labelMap = new HashMap<>();
|
||||
while (queryLabel.next()){
|
||||
String fieldname = queryLabel.getString("FIELDNAME");
|
||||
String labelname = queryLabel.getString("LABELNAME");
|
||||
labelMap.put(fieldname,labelname);
|
||||
}
|
||||
|
||||
Map<String,Map<String,String>> selectItemMap = mapSelectItem(billid); // 选择框选项
|
||||
Map<String,String> liulanMap = mapLiuLan(billid); // 浏览按钮
|
||||
Map<String,String> commonLiuLanMap = mapCommonLiuLan(billid); // 浏览按钮
|
||||
Set<String> checkSet = getCheckFieldName(billid); // check字段
|
||||
Set<String> fileFieldSet = getFileFieldSet(billid); // 文件字段
|
||||
|
||||
bb.writeLog("》》》 select item >> "+ JSON.toJSONString(selectItemMap));
|
||||
bb.writeLog("》》》 liulanMap >> "+ JSON.toJSONString(liulanMap));
|
||||
|
||||
for (String tempname : filedNameList) {
|
||||
String labelName = labelMap.getOrDefault(tempname,tempname);
|
||||
String value = paramMap.getOrDefault(tempname, "");
|
||||
if (!"".equals(value)){
|
||||
bb.writeLog(">>> for tempname >> "+tempname);
|
||||
|
||||
if (selectItemMap.containsKey(tempname)){ // 选择框
|
||||
bb.writeLog("select item >> "+tempname+" >> "+value);
|
||||
Map<String,String> selectItem = selectItemMap.get(tempname);
|
||||
String [] valueArray = value.split(",");
|
||||
List<String> valueList = new ArrayList<>();
|
||||
for (String tempValue : valueArray){
|
||||
String tempValueName = selectItem.getOrDefault(tempValue,tempValue);
|
||||
valueList.add(tempValueName);
|
||||
}
|
||||
bb.writeLog("> select item >> "+tempname+" >> "+valueList);
|
||||
value = String.join(", ",valueList);
|
||||
|
||||
} else if (checkSet.contains(tempname)){ // check字段
|
||||
bb.writeLog("checkSet >> "+tempname+" >> "+value);
|
||||
value= "1".equals(value) ? "Yes" : "No";
|
||||
|
||||
} else if (fileFieldSet.contains(tempname)){ // 附件字段
|
||||
bb.writeLog("fileFieldSet >> "+tempname+" >> "+value);
|
||||
List<String> fileList = new ArrayList<>();
|
||||
RecordSet queryTemp = new RecordSet();
|
||||
queryTemp.executeQuery("select IMAGEFILENAME from docimagefile where docid in ("+value+")");
|
||||
while (queryTemp.next()){
|
||||
String tempValueName = queryTemp.getString("IMAGEFILENAME");
|
||||
fileList.add(tempValueName);
|
||||
}
|
||||
value = String.join(", ",fileList);
|
||||
|
||||
} else if (liulanMap.containsKey(tempname)){ //自定义浏览框
|
||||
String searchById = liulanMap.get(tempname);
|
||||
bb.writeLog("liulanMap >> "+tempname+" >> "+searchById);
|
||||
String [] valueArray = value.split(",");
|
||||
List<String> valueList = new ArrayList<>();
|
||||
RecordSet queryTemp = new RecordSet();
|
||||
|
||||
for (String tempValue : valueArray){
|
||||
bb.writeLog("liulanMap >> "+tempname+" >> "+searchById+" >> "+tempValue);
|
||||
queryTemp.executeQuery(searchById,tempValue);
|
||||
if (queryTemp.next()){
|
||||
String tempValueName = queryTemp.getString(1);
|
||||
bb.writeLog("query reuslt ");
|
||||
valueList.add(tempValueName);
|
||||
}else {
|
||||
bb.writeLog("query reuslt null");
|
||||
}
|
||||
}
|
||||
value = String.join(", ",valueList);
|
||||
|
||||
} else if (commonLiuLanMap.containsKey(tempname)){ // 公共浏览框类型
|
||||
String fieldType = commonLiuLanMap.get(tempname);
|
||||
bb.writeLog("commonLiuLanMap >> "+tempname+" >> "+fieldType + " >>value= "+value);
|
||||
|
||||
RecordSet queryTemp = new RecordSet();
|
||||
|
||||
switch (fieldType){
|
||||
case "1": // 单选人力
|
||||
queryTemp.executeQuery("select LASTNAME from hrmresource h where id =?",value);
|
||||
if (queryTemp.next()){
|
||||
value = Util.null2String(queryTemp.getString("LASTNAME"));
|
||||
}
|
||||
break;
|
||||
|
||||
case "17": // 多选人力
|
||||
queryTemp.executeQuery("select LASTNAME from hrmresource h where id in ("+value+")");
|
||||
List<String> valueList = new ArrayList<>();
|
||||
while (queryTemp.next()){
|
||||
valueList.add(Util.null2String(queryTemp.getString("LASTNAME")));
|
||||
}
|
||||
bb.writeLog("user list >> "+ JSON.toJSONString(valueList));
|
||||
value = String.join(", ",valueList);
|
||||
break;
|
||||
|
||||
case "4": // 单选部门
|
||||
queryTemp.executeQuery("select DEPARTMENTNAME from hrmdepartment where id=?",value);
|
||||
if (queryTemp.next()){
|
||||
value = Util.null2String(queryTemp.getString("DEPARTMENTNAME"));
|
||||
}
|
||||
break;
|
||||
|
||||
case "57": // 多选部门
|
||||
queryTemp.executeQuery("select DEPARTMENTNAME from hrmdepartment where id in ("+value+")");
|
||||
List<String> valueList2 = new ArrayList<>();
|
||||
while (queryTemp.next()){
|
||||
valueList2.add(Util.null2String(queryTemp.getString("DEPARTMENTNAME")));
|
||||
}
|
||||
bb.writeLog("dep lis is >> "+ JSON.toJSONString(valueList2));
|
||||
value = String.join(", ",valueList2);
|
||||
break;
|
||||
|
||||
case "16": // 单选流程
|
||||
queryTemp.executeQuery("select REQUESTNAME from workflow_requestbase where REQUESTID =?",value);
|
||||
if (queryTemp.next()){
|
||||
value = Util.null2String(queryTemp.getString("REQUESTNAME"));
|
||||
}
|
||||
break;
|
||||
|
||||
case "152": // 多选流程
|
||||
queryTemp.executeQuery("select REQUESTNAME from workflow_requestbase where REQUESTID in ("+value+")");
|
||||
List<String> valueList3 = new ArrayList<>();
|
||||
while (queryTemp.next()){
|
||||
valueList3.add(Util.null2String(queryTemp.getString("REQUESTNAME")));
|
||||
}
|
||||
bb.writeLog("request list >> "+ JSON.toJSONString(valueList3));
|
||||
value = String.join(", ",valueList3);
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
value = value.replace(" ", " ");
|
||||
value = value.replace("<br>", " ");
|
||||
}
|
||||
}
|
||||
cardJsonArray.add(
|
||||
new JSONObject().fluentPut("name", labelName).fluentPut("value", value)
|
||||
);
|
||||
}
|
||||
}
|
||||
return cardJsonArray;
|
||||
}
|
||||
|
||||
|
||||
// 选择框选项数据
|
||||
private Map<String,Map<String,String>> mapSelectItem(Integer billid){
|
||||
RecordSet query = new RecordSet();
|
||||
query.executeQuery("select a.FIELDNAME , b.SELECTVALUE , b.SELECTNAME from workflow_billfield a left join workflow_selectitem b on a.id=b.FIELDID where a.billid=? and a.fieldhtmltype=5 order by a.id",billid);
|
||||
Map<String,Map<String,String>> map = new HashMap<>();
|
||||
while (query.next()){
|
||||
String fieldname = query.getString("FIELDNAME");
|
||||
String selectvalue = query.getString("SELECTVALUE");
|
||||
String selectname = query.getString("SELECTNAME");
|
||||
if (map.containsKey(fieldname)){
|
||||
map.get(fieldname).put(selectvalue,selectname);
|
||||
}else{
|
||||
Map<String,String> tempMap = new HashMap<>();
|
||||
tempMap.put(selectvalue,selectname);
|
||||
map.put(fieldname,tempMap);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// 勾选框字段名
|
||||
private Set<String> getCheckFieldName(Integer billid){
|
||||
Set<String> set = new HashSet<>();
|
||||
RecordSet query = new RecordSet();
|
||||
query.executeQuery("select FIELDNAME from workflow_billfield where BILLID =? and FIELDHTMLTYPE=4",billid);
|
||||
while (query.next()){
|
||||
set.add(query.getString("FIELDNAME"));
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
// 附件选择
|
||||
private Set<String> getFileFieldSet(Integer billid){
|
||||
Set<String> set = new HashSet<>();
|
||||
RecordSet query = new RecordSet();
|
||||
query.executeQuery("select FIELDNAME from workflow_billfield where BILLID =? and FIELDHTMLTYPE=6",billid);
|
||||
while (query.next()){
|
||||
set.add(query.getString("FIELDNAME"));
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
// 浏览按钮
|
||||
private Map<String,String> mapLiuLan(Integer billid){
|
||||
RecordSet query = new RecordSet();
|
||||
Map<String,String> map = new HashMap<>();
|
||||
query.executeQuery("select FIELDNAME, FIELDDBTYPE from workflow_billfield where BILLID =? and FIELDDBTYPE like 'browser.%'",billid);
|
||||
while (query.next()){
|
||||
String fieldname = query.getString("FIELDNAME");
|
||||
String fielddbtpye = query.getString("FIELDDBTYPE");
|
||||
String showname = fielddbtpye.substring(8);
|
||||
RecordSet query2 = new RecordSet();
|
||||
query2.executeQuery("select searchById from mode_browser where showname =?",showname);
|
||||
if (query2.next()){
|
||||
String searchById = query2.getString("searchById");
|
||||
map.put(fieldname,searchById);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// 公共浏览框类型
|
||||
private Map<String,String> mapCommonLiuLan(Integer billid){
|
||||
Map<String,String> map = new HashMap<>();
|
||||
RecordSet query = new RecordSet();
|
||||
query.executeQuery("select FIELDNAME, type from workflow_billfield wb where FIELDHTMLTYPE=3 and BILLID = ?",billid);
|
||||
while (query.next()){
|
||||
String fieldname = query.getString("FIELDNAME");
|
||||
String fielddbtpye = query.getString("type");
|
||||
map.put(fieldname,fielddbtpye);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
package weaver.interfaces.dito.delete;
|
||||
|
||||
import com.customization.dito.sendtodo.RequestBaseInfoUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RequestDeleteQueryPortalUtil {
|
||||
|
||||
private RequestBaseInfoUtil requestBaseInfoUtil = new RequestBaseInfoUtil();
|
||||
/**
|
||||
*
|
||||
* @param requestid
|
||||
*/
|
||||
public List<Map<String,String>> queryRequestReamrk89ByDelete(String requestid){
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("queryRequestReamrk8ByDelete-requestid:"+requestid);
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
try{
|
||||
if(StringUtils.isNotBlank(requestid)){
|
||||
String sql =" select t.userid,t.nodeid,t.requestid,t2.nodename,t1.requestname,t3.workflowname,h2.loginid\n" +
|
||||
" from workflow_currentoperator t\n" +
|
||||
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
|
||||
" left join (select id,lastname,loginid from hrmresource union all select id,lastname,loginid from hrmresourcemanager ) h2 on h2.id = t1.creater \n" +
|
||||
" left join workflow_nodebase t2 on t2.id = t.nodeid \n" +
|
||||
" left join workflow_base t3 on t3.id = t1.workflowid\n" +
|
||||
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
|
||||
" and t.preisremark in (8,9)\n" +
|
||||
" and t.requestid in("+requestid +") " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
bb.writeLog("queryWorkflowCopyToByRequestid-sql:"+sql);
|
||||
|
||||
while (rs.next()){
|
||||
String nodeid = Util.null2String(rs.getString("nodeid"));
|
||||
String userid = Util.null2String(rs.getString("userid"));
|
||||
String nodename = Util.null2String(rs.getString("nodename"));
|
||||
String workflowname = Util.null2String(rs.getString("workflowname")) ;
|
||||
String requestname = Util.null2String(rs.getString("requestname")) ;
|
||||
String lcid = Util.null2String(rs.getString("requestid")) ;
|
||||
String creater = Util.null2String(rs.getString("loginid")) ;
|
||||
|
||||
Map<String,String> map = new HashMap<String, String>();
|
||||
map.put("requestid",requestid);
|
||||
map.put("userid",userid);
|
||||
map.put("nodeid",nodeid);
|
||||
map.put("nodename",nodename);
|
||||
map.put("workflowname",workflowname);
|
||||
map.put("requestname",requestname);
|
||||
map.put("lcid",lcid);
|
||||
map.put("creater",creater);
|
||||
list.add(map);
|
||||
}
|
||||
bb.writeLog("queryWorkflowCopyToByRequestid-list:"+list.size());
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Map<String,String>> queryRequestForwardByDelete(String requestid){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("queryRequestForwardByDelete-requestid:"+requestid);
|
||||
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
|
||||
try{
|
||||
if(StringUtils.isNotBlank(requestid)){
|
||||
String sql =" select t.userid,t.nodeid,t.requestid,t2.nodename,t1.requestname,t3.workflowname,h2.loginid\n" +
|
||||
" from workflow_currentoperator t\n" +
|
||||
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
|
||||
" left join (select id,lastname,loginid from hrmresource union all select id,lastname,loginid from hrmresourcemanager ) h2 on h2.id = t1.creater \n" +
|
||||
" left join workflow_nodebase t2 on t2.id = t.nodeid \n" +
|
||||
" left join workflow_base t3 on t3.id = t1.workflowid\n" +
|
||||
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
|
||||
" and t.preisremark = 1 \n" +
|
||||
" and t.requestid in("+requestid +") " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
bb.writeLog("queryWorkflowForwardByRequestid-sql:"+sql);
|
||||
|
||||
while (rs.next()){
|
||||
String nodeid = Util.null2String(rs.getString("nodeid"));
|
||||
String userid = Util.null2String(rs.getString("userid"));
|
||||
String nodename = Util.null2String(rs.getString("nodename"));
|
||||
String workflowname = Util.null2String(rs.getString("workflowname")) ;
|
||||
String requestname = Util.null2String(rs.getString("requestname")) ;
|
||||
String lcid = Util.null2String(rs.getString("requestid")) ;
|
||||
String creater = Util.null2String(rs.getString("loginid")) ;
|
||||
|
||||
Map<String,String> map = new HashMap<String, String>();
|
||||
map.put("requestid",requestid);
|
||||
map.put("userid",userid);
|
||||
map.put("nodeid",nodeid);
|
||||
map.put("nodename",nodename);
|
||||
map.put("workflowname",workflowname);
|
||||
map.put("requestname",requestname);
|
||||
map.put("lcid",lcid);
|
||||
map.put("creater",creater);
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> queryRequestAtByDelete(String requestid){
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("queryRequestAtByDelete-requestid:"+requestid);
|
||||
|
||||
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
try{
|
||||
if (StringUtils.isNotBlank(requestid)) {
|
||||
String sql =" select t.userid,t.nodeid,t.requestid,t2.nodename,t1.requestname,t3.workflowname,h2.loginid\n" +
|
||||
" from workflow_currentoperator t\n" +
|
||||
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
|
||||
" left join (select id,lastname,loginid from hrmresource union all select id,lastname,loginid from hrmresourcemanager ) h2 on h2.id = t1.creater \n" +
|
||||
" left join workflow_nodebase t2 on t2.id = t.nodeid \n" +
|
||||
" left join workflow_base t3 on t3.id = t1.workflowid\n" +
|
||||
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
|
||||
" and t.preisremark in (18) \n" +
|
||||
" and t.requestid in("+requestid +") " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
bb.writeLog("queryWorkflowAtByRequestid-sql:"+sql);
|
||||
|
||||
while (rs.next()){
|
||||
String nodeid = Util.null2String(rs.getString("nodeid"));
|
||||
String userid = Util.null2String(rs.getString("userid"));
|
||||
String nodename = Util.null2String(rs.getString("nodename"));
|
||||
String workflowname = Util.null2String(rs.getString("workflowname")) ;
|
||||
String requestname = Util.null2String(rs.getString("requestname")) ;
|
||||
String lcid = Util.null2String(rs.getString("requestid")) ;
|
||||
String creater = Util.null2String(rs.getString("loginid")) ;
|
||||
|
||||
Map<String,String> map = new HashMap<String, String>();
|
||||
map.put("requestid",requestid);
|
||||
map.put("userid",userid);
|
||||
map.put("nodeid",nodeid);
|
||||
map.put("nodename",nodename);
|
||||
map.put("workflowname",workflowname);
|
||||
map.put("requestname",requestname);
|
||||
map.put("lcid",lcid);
|
||||
map.put("creater",creater);
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Map<String,String>> queryRequestDataByDelete(String requestids){
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("queryRequestDataByDelete-requestid:"+requestids);
|
||||
|
||||
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
try{
|
||||
if (StringUtils.isNotBlank(requestids)) {
|
||||
String[] requestid = requestids.split(",");
|
||||
for(int i=0;i<requestid.length;i++){
|
||||
bb.writeLog("queryRequestDataByDelete-requestid-i:"+requestid[i]);
|
||||
Map<String,String> baseMap = requestBaseInfoUtil.queryRequestBaseByRequestid(requestid[i]);
|
||||
list.add(baseMap);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
bb.writeLog("queryRequestDataByDelete-list:"+list.size());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package weaver.interfaces.dito.delete;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.customization.dito.sendtodo.HttpRequestUtil;
|
||||
import com.customization.dito.sendtodo.SendPortalErrorUtil;
|
||||
import com.time.util.DateUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.dito.comInfo.PropBean;
|
||||
import weaver.interfaces.dito.constant.Constants;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RequestDeleteRemarkAtSendPortalUtil {
|
||||
|
||||
public void requestDeleteByAt(List<Map<String,String>> list,String loginid,String notes){
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("requestDeleteByAt-loginid:" + loginid);
|
||||
for(int i=0;i<list.size();i++){
|
||||
|
||||
Map<String,String> dataMap = list.get(i);
|
||||
String requestid = Util.null2String(dataMap.get("lcid"));
|
||||
String userid = Util.null2String(dataMap.get("userid"));
|
||||
String nodeid = Util.null2String(dataMap.get("nodeid"));
|
||||
String nodename = Util.null2String(dataMap.get("nodename"));
|
||||
String requestname = Util.null2String(dataMap.get("requestname"));
|
||||
String workflowname = Util.null2String(dataMap.get("workflowname"));
|
||||
String creater = Util.null2String(dataMap.get("creater"));
|
||||
|
||||
if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(requestid)){
|
||||
requestDeleteByAt2UserId(requestid,userid,nodeid,loginid,workflowname,requestname,nodename,notes,creater);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 完成@数据
|
||||
* @param requestid
|
||||
* @param userid
|
||||
*/
|
||||
private void requestDeleteByAt2UserId(String requestid,String userid,String nodeid,String loginid,String workflowname,String requestname,String nodename,String notes,String createrLoginId){
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
RecordSet rs = new RecordSet();
|
||||
bb.writeLog("monitorFinishedWorkflowAtByUserId-requestid:"+requestid);
|
||||
|
||||
// String notes = "流程监控删除后,删除未读的@数据";
|
||||
String portal_todourl = Constants.portal_todourl;
|
||||
String bpm_app_workflowurl = Constants.bpm_app_workflowurl;
|
||||
String username = Constants.username;
|
||||
String passwd = Constants.passwd;
|
||||
String bpm_workflowurl = Constants.bpm_workflowurl;
|
||||
String center = Constants.center;
|
||||
String bpm_app_requesturl = Constants.bpm_app_requesturl;
|
||||
|
||||
String zhjkbs = "weaver.interfaces.dito.delete.RequestDeleteRemarkAtSendPortalUtil.requestDeleteByAt2UserId" ;
|
||||
|
||||
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
|
||||
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
|
||||
|
||||
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
|
||||
|
||||
String actionType = "3";
|
||||
String terminal = "1" ;
|
||||
String taskType = "1";
|
||||
|
||||
try {
|
||||
|
||||
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
|
||||
String replace = bpm_app_workflowurl.replace("/bpm", "");
|
||||
String urlDing = replace+bpm_app_requesturl+requestid;
|
||||
String urlApp = replace+bpm_app_requesturl+requestid;
|
||||
if(org.apache.commons.lang.StringUtils.isNotEmpty(mobileJumpUrl)){
|
||||
urlDing += "&returnUrl="+ URLEncoder.encode(mobileJumpUrl,"UTF-8");
|
||||
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
|
||||
}
|
||||
|
||||
JSONObject requestObject = new JSONObject();
|
||||
requestObject.put("creator",createrLoginId);
|
||||
requestObject.put("title",requestname);
|
||||
requestObject.put("messageContent",requestname);
|
||||
requestObject.put("nodeId",nodeid);
|
||||
requestObject.put("nodeName",nodename);
|
||||
requestObject.put("ticketType",workflowname);
|
||||
|
||||
requestObject.put("center", center);
|
||||
requestObject.put("taskType", taskType);
|
||||
requestObject.put("actionType", actionType);
|
||||
requestObject.put("createDate", processTime);
|
||||
requestObject.put("messageTitle",requestname);
|
||||
requestObject.put("terminal", terminal);
|
||||
requestObject.put("urlPc", urlPc);
|
||||
requestObject.put("urlDing", urlDing);
|
||||
requestObject.put("urlApp",urlApp);
|
||||
requestObject.put("taskCode", "weaver"+requestid+"_at_"+userid);
|
||||
|
||||
String auth = username + ":" + passwd;
|
||||
bb.writeLog("monitorFinishedWorkflowAtByUserId--requestObject:" + requestObject.toJSONString());
|
||||
String msgdata = httpRequestUtil.doPostByAuth(portal_todourl, requestObject.toJSONString(), auth);
|
||||
bb.writeLog("monitorFinishedWorkflowAtByUserId-msgdata:" + msgdata);
|
||||
if (!"".equals(msgdata)) {
|
||||
JSONObject msgObject = JSONObject.parseObject(msgdata);
|
||||
if (msgObject.containsKey("resultCode")) {
|
||||
String resultCode = msgObject.getString("resultCode");
|
||||
if ("0".equals(resultCode)) {
|
||||
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2Optimize(requestid,nodeid,nodename,userid,requestObject.toJSONString(),resultCode,"",zhjkbs,userid,notes);
|
||||
}else{
|
||||
String resultmsg = msgObject.getString("resultMsg");
|
||||
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2Optimize(requestid,nodeid,nodename,userid,requestObject.toJSONString(),resultCode,resultmsg,zhjkbs,userid,notes);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,231 @@
|
||||
package weaver.interfaces.dito.forword;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.customization.dito.sendtodo.HttpRequestUtil;
|
||||
import com.customization.dito.sendtodo.SendMailUtil;
|
||||
import com.customization.dito.sendtodo.SendPortalErrorUtil;
|
||||
import com.time.util.DateUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.dito.comInfo.PropBean;
|
||||
import weaver.interfaces.dito.constant.Constants;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class SendPortalTransferUtil {
|
||||
|
||||
public static String EMAIL_REGEX_DEFAULT = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
|
||||
Pattern regex = Pattern.compile(EMAIL_REGEX_DEFAULT);
|
||||
|
||||
public void requestTransferSendPortal(String requestid, int currentnodeid, User user){
|
||||
|
||||
String scopeid = "-1";
|
||||
String scope = "HrmCustomFieldByInfoType" ;
|
||||
|
||||
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
|
||||
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
|
||||
SendMailUtil sendMailUtil = new SendMailUtil();
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
|
||||
bb.writeLog("======== SendPortalTransferUtil transferSendPortal ========================="+requestid);
|
||||
String bpm_app_workflowurl = PropBean.getUfPropValue("bpm_app_workflowurl");
|
||||
String bpm_app_requesturl = PropBean.getUfPropValue("bpm_app_requesturl");
|
||||
String portal_todourl = PropBean.getUfPropValue("portal_todourl");
|
||||
String username = PropBean.getUfPropValue("username");
|
||||
String passwd = PropBean.getUfPropValue("passwd");
|
||||
String center = PropBean.getUfPropValue("center");
|
||||
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
|
||||
|
||||
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
|
||||
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
String zhjkbs = "weaver.interfaces.dito.forword.SendPortalTransferUtil.requestTransferSendPortal";
|
||||
String actionType = "2";
|
||||
String terminal = "1";
|
||||
String taskType = "0";
|
||||
String objectAction = "0";
|
||||
String objectType = "0";
|
||||
|
||||
String workflowname = "";
|
||||
String nodeId = "";
|
||||
String nodeName = "";
|
||||
JSONObject requestObject = new JSONObject();
|
||||
|
||||
String urlPc = "[newtab]"+ Constants.bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
|
||||
String replace = bpm_app_workflowurl.replace("/bpm", "");
|
||||
String urlDing = replace+bpm_app_requesturl+requestid ;
|
||||
String urlApp = replace+bpm_app_requesturl+requestid ;
|
||||
if(StringUtils.isNotEmpty(mobileJumpUrl)){
|
||||
urlDing += "&returnUrl="+ URLEncoder.encode(mobileJumpUrl,"UTF-8");
|
||||
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
|
||||
}
|
||||
|
||||
String msgdata = "";
|
||||
String requestname = "";
|
||||
String lastname = "";
|
||||
String userids = "";
|
||||
String loginid = "";
|
||||
String emailArray = "";
|
||||
|
||||
String sql =" select t1.requestname,t1.currentnodeid as nodeid,d1.nodename,t3.workflowname,h2.lastname,h2.loginid " +
|
||||
" from workflow_requestbase t1\n" +
|
||||
" inner join workflow_base t3 on t1.workflowid = t3.id\n" +
|
||||
" left join workflow_nodebase d1 on d1.id = t1.currentnodeid " +
|
||||
" left join (select id,lastname,loginid from hrmresource where status = 1 union all select id,lastname,loginid from hrmresourcemanager ) h2 on h2.id = t1.creater \n" +
|
||||
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
|
||||
" and t1.requestid = " + requestid;
|
||||
|
||||
bb.writeLog("SendPortalForwardCmd transfer --sql:" + sql);
|
||||
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()) {
|
||||
requestname = Util.null2String(rs.getString("requestname"));
|
||||
workflowname = Util.null2String(rs.getString("workflowname"));
|
||||
nodeId = Util.null2String(rs.getString("nodeid") + user.getUID());
|
||||
nodeName = Util.null2String(rs.getString("nodeName"));
|
||||
lastname = Util.null2String(rs.getString("lastname"));
|
||||
loginid = Util.null2String(rs.getString("loginid"));
|
||||
}
|
||||
|
||||
JSONArray taskObjectList = new JSONArray();
|
||||
|
||||
requestObject.put("creator", loginid);
|
||||
requestObject.put("center", center);
|
||||
requestObject.put("title", requestname);
|
||||
requestObject.put("taskCode", "weaver" + requestid);
|
||||
requestObject.put("nodeId", currentnodeid);
|
||||
requestObject.put("taskType", taskType);
|
||||
requestObject.put("actionType", actionType);
|
||||
requestObject.put("createDate", processTime);
|
||||
requestObject.put("messageTitle", getShortMessageTitle(requestname));
|
||||
requestObject.put("messageContent", requestname);
|
||||
requestObject.put("terminal", terminal);
|
||||
requestObject.put("urlPc", urlPc);
|
||||
requestObject.put("urlApp", urlApp);
|
||||
requestObject.put("urlDing", urlDing);
|
||||
requestObject.put("nodeName", getNodeName(currentnodeid));
|
||||
requestObject.put("ticketType", workflowname);
|
||||
|
||||
sql = " select t2.userid,h1.loginid,h1.email,c1." + cus_staff + " as staffid " +
|
||||
" from workflow_requestbase t1\n" +
|
||||
" inner join workflow_currentoperator t2 on t1.requestid = t2.requestid\n" +
|
||||
" left join cus_fielddata c1 on c1.id = t2.userid and c1.scopeid= " + scopeid + " and c1.scope = '" + scope + "' " +
|
||||
" left join (select id, lastname,loginid,email from hrmresource where STATUS = 1 union all select id,lastname,loginid,'' as email from hrmresourcemanager ) h1 on h1.id = t2.userid\n" +
|
||||
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
|
||||
" and ((t2.isremark = '0' and (t2.takisremark is null or t2.takisremark = 0)) or t2.isremark in ('5', '7','11'))\n" +
|
||||
" and t2.islasttimes = 1\n" +
|
||||
" and (t2.isprocessing = '' or t2.isprocessing is null)\n" +
|
||||
" and t2.requestid = " + requestid;
|
||||
|
||||
bb.writeLog("SendPortalForwardCmd transfer --sql:" + sql);
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
JSONObject taskObject = new JSONObject();
|
||||
|
||||
String usercode = Util.null2String(rs.getString("loginid"));
|
||||
String staffid = Util.null2String(rs.getString("staffid"));
|
||||
String userid1 = Util.null2String(rs.getString("userid"));
|
||||
userids += StringUtils.isEmpty(userids) ? userid1 : "," + userid1;
|
||||
|
||||
String objectCode = usercode;
|
||||
String operatorCode = usercode;
|
||||
|
||||
taskObject.put("objectAction", objectAction);
|
||||
taskObject.put("objectType", objectType);
|
||||
taskObject.put("objectCode", objectCode);
|
||||
taskObject.put("objectId", staffid);
|
||||
taskObject.put("operatorCode", operatorCode);
|
||||
taskObjectList.add(taskObject);
|
||||
|
||||
String email = Util.null2String(rs.getString("email"));
|
||||
bb.writeLog("SendPortalForwardCmd transfer email:" + email);
|
||||
Matcher matcher = regex.matcher(email);
|
||||
if (matcher.matches()) {
|
||||
emailArray += StringUtils.isEmpty(emailArray) ? email : "," + email;
|
||||
}
|
||||
}
|
||||
if (taskObjectList.size() > 0) {
|
||||
requestObject.put("taskObjectList", taskObjectList);
|
||||
} else {
|
||||
requestObject.put("actionType", "3");
|
||||
}
|
||||
bb.writeLog("================ SendPortalForwardCmd transfer requestObject ============= "+ requestObject.toJSONString());
|
||||
String auth = username + ":" + passwd;
|
||||
msgdata = httpRequestUtil.doPostByAuth(portal_todourl, requestObject.toJSONString(), auth);
|
||||
if (!"".equals(msgdata)) {
|
||||
JSONObject msgObject = JSONObject.parseObject(msgdata);
|
||||
bb.writeLog("================ SendPortalForwardCmd transfer msgObject ============= "+ msgObject.toJSONString());
|
||||
if (msgObject.containsKey("resultCode")) {
|
||||
String resultCode = msgObject.getString("resultCode");
|
||||
if ("0".equals(resultCode)) {
|
||||
|
||||
bb.writeLog("SendPortalForwardCmd transfer emailArray:" + emailArray);
|
||||
if (StringUtils.isNotEmpty(emailArray)) {
|
||||
|
||||
Map<String, String> templateMap = getEmailTemplate(requestname, lastname, processTime);
|
||||
String notificationSubject = templateMap.get("notificationSubject");
|
||||
String notificationContent = templateMap.get("notificationContent");
|
||||
|
||||
sendMailUtil.sendMail(requestid, emailArray, notificationSubject, notificationContent);
|
||||
}
|
||||
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2(requestid, nodeId, nodeName, String.valueOf(user.getUID()), requestObject.toJSONString(), resultCode, "",zhjkbs,userids);
|
||||
} else {
|
||||
String resultmsg = msgObject.getString("resultMsg");
|
||||
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2(requestid, nodeId, nodeName, String.valueOf(user.getUID()), requestObject.toJSONString(), resultCode, resultmsg ,zhjkbs,userids);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
bb.writeLog(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getShortMessageTitle(String messageTitle) {
|
||||
if (messageTitle.length() > 20) {
|
||||
messageTitle = messageTitle.substring(0, 17) + "...";
|
||||
}
|
||||
return messageTitle;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param requestname
|
||||
* @param operator
|
||||
* @param operatorTime
|
||||
* @return
|
||||
*/
|
||||
public Map<String,String> getEmailTemplate(String requestname,String operator,String operatorTime){
|
||||
Map<String,String> dataMap = new HashMap<String,String>();
|
||||
|
||||
String notificationSubject = "You have a new To-Read - <"+requestname+"> ";
|
||||
String notificationContent = operator + " created this task on "+operatorTime+"\n" +
|
||||
" Please handle it in time.";
|
||||
|
||||
dataMap.put("notificationSubject",notificationSubject);
|
||||
dataMap.put("notificationContent",notificationContent);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
public String getNodeName(int nodeid){
|
||||
RecordSet rs = new RecordSet();
|
||||
String name = "";
|
||||
rs.executeQuery(" select nodename from workflow_nodebase where id = ?",nodeid);
|
||||
while (rs.next()){
|
||||
name = Util.null2String(rs.getString("nodename"));
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,244 @@
|
||||
package weaver.interfaces.dito.intervention;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.customization.dito.sendtodo.HttpRequestUtil;
|
||||
import com.customization.dito.sendtodo.RequestBaseInfoUtil;
|
||||
import com.customization.dito.sendtodo.SendPortalErrorUtil;
|
||||
import com.time.util.DateUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.dito.comInfo.PropBean;
|
||||
import weaver.interfaces.dito.constant.Constants;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RequestInterventionSendPortalUtil {
|
||||
|
||||
|
||||
RequestBaseInfoUtil requestBaseInfoUtil = new RequestBaseInfoUtil();
|
||||
|
||||
/***
|
||||
* intervention 流程干预
|
||||
* @param requestid
|
||||
* @param currentUserId
|
||||
*/
|
||||
public void monitorIntervention(String requestid,String currentUserId){
|
||||
monitorInterventionByUserId(requestid,currentUserId);
|
||||
}
|
||||
|
||||
/***
|
||||
* 流程干预
|
||||
* @param requestid
|
||||
* @param currentUserId
|
||||
*/
|
||||
public void monitorInterventionByUserId(String requestid,String currentUserId){
|
||||
|
||||
String portal_todourl = Constants.portal_todourl;
|
||||
String bpm_app_workflowurl = Constants.bpm_app_workflowurl;
|
||||
String username = Constants.username;
|
||||
String passwd = Constants.passwd;
|
||||
String bpm_workflowurl = Constants.bpm_workflowurl;
|
||||
String center = Constants.center;
|
||||
String bpm_app_requesturl = Constants.bpm_app_requesturl;
|
||||
|
||||
String zhjkbs = "weaver.interfaces.dito.monitor.SendPortalMonitorUtil.monitorInterventionByUserId" ;
|
||||
|
||||
SendPortalErrorUtil sendPortalErrorUtil = new SendPortalErrorUtil();
|
||||
HttpRequestUtil httpRequestUtil = new HttpRequestUtil();
|
||||
String mobileJumpUrl = PropBean.getUfPropValue("mobileJumpUrl");
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("SendPortalMonitorUtil--monitorIntervention");
|
||||
String terminal = "1" ;
|
||||
String taskType = "0";
|
||||
|
||||
try {
|
||||
|
||||
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
|
||||
String urlPc = "[newtab]"+bpm_workflowurl+"/workflow/request/ViewRequestForwardSPA.jsp?requestid="+requestid ;
|
||||
String replace = bpm_app_workflowurl.replace("/bpm", "");
|
||||
String urlDing = replace+bpm_app_requesturl+requestid;
|
||||
String urlApp = replace+bpm_app_requesturl+requestid;
|
||||
|
||||
if(StringUtils.isNotEmpty(mobileJumpUrl)){
|
||||
urlDing += "&returnUrl="+ URLEncoder.encode(mobileJumpUrl,"UTF-8");
|
||||
urlApp += "&returnUrl="+URLEncoder.encode(mobileJumpUrl,"UTF-8");
|
||||
}
|
||||
bb.writeLog("monitorIntervention-urlDing", urlDing);
|
||||
|
||||
Map<String,String> baseMap = requestBaseInfoUtil.queryRequestBaseByRequestid(requestid);
|
||||
String currentNodeId = baseMap.get("currentnodeid");
|
||||
String currentNodeName = baseMap.get("currentnodeid");
|
||||
String workflowname = baseMap.get("workflowname");
|
||||
String createrLoginId = baseMap.get("createrloginid");
|
||||
String createrLastName = baseMap.get("createrusername");
|
||||
String requestname = baseMap.get("requestname");
|
||||
String currentnodetype = baseMap.get("currentnodetype");
|
||||
|
||||
|
||||
if("3".equals(currentnodetype)){
|
||||
String actionType = "3" ;
|
||||
|
||||
JSONObject requestObject = new JSONObject();
|
||||
requestObject.put("creator",createrLoginId);
|
||||
requestObject.put("title",requestname);
|
||||
requestObject.put("messageContent",requestname);
|
||||
requestObject.put("nodeId",currentNodeId);
|
||||
requestObject.put("nodeName",currentNodeName);
|
||||
requestObject.put("ticketType",workflowname);
|
||||
|
||||
requestObject.put("center",center);
|
||||
requestObject.put("taskCode","weaver"+requestid);
|
||||
requestObject.put("taskType",taskType);
|
||||
requestObject.put("actionType",actionType);
|
||||
requestObject.put("createDate",processTime);
|
||||
requestObject.put("messageTitle",getShortMessageTitle(requestname));
|
||||
requestObject.put("terminal",terminal);
|
||||
requestObject.put("urlPc",urlPc);
|
||||
requestObject.put("urlApp",urlApp);
|
||||
requestObject.put("urlDing",urlDing);
|
||||
|
||||
String auth = username + ":" + passwd;
|
||||
bb.writeLog("monitorIntervention---requestObject:"+requestObject.toJSONString());
|
||||
String msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth);
|
||||
|
||||
if (!"".equals(msgdata)) {
|
||||
JSONObject msgObject = JSONObject.parseObject(msgdata);
|
||||
if (msgObject.containsKey("resultCode")) {
|
||||
String resultCode = msgObject.getString("resultCode");
|
||||
if ("0".equals(resultCode)) {
|
||||
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2(requestid,currentNodeId,currentNodeName,currentUserId,requestObject.toJSONString(),resultCode,"",zhjkbs,"");
|
||||
}else{
|
||||
String resultmsg = msgObject.getString("resultMsg");
|
||||
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2(requestid,currentNodeId,currentNodeName,currentUserId,requestObject.toJSONString(),resultCode,resultmsg,zhjkbs,"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String actionType = "2" ;
|
||||
String nextNodeUserIds = "";
|
||||
|
||||
int count = requestBaseInfoUtil.getTodoCountByRequestid(requestid) ;
|
||||
|
||||
bb.writeLog("monitorIntervention--count:"+count);
|
||||
if(count >0){
|
||||
|
||||
JSONObject requestObject = new JSONObject();
|
||||
requestObject.put("creator",createrLoginId);
|
||||
requestObject.put("title",requestname);
|
||||
requestObject.put("messageContent",requestname);
|
||||
requestObject.put("nodeId",currentNodeId);
|
||||
requestObject.put("nodeName",currentNodeName);
|
||||
requestObject.put("ticketType",workflowname);
|
||||
|
||||
requestObject.put("center",center);
|
||||
requestObject.put("taskCode","weaver"+requestid);
|
||||
requestObject.put("taskType",taskType);
|
||||
requestObject.put("actionType",actionType);
|
||||
requestObject.put("createDate",processTime);
|
||||
requestObject.put("messageTitle",getShortMessageTitle(requestname));
|
||||
requestObject.put("terminal",terminal);
|
||||
requestObject.put("urlPc",urlPc);
|
||||
requestObject.put("urlApp",urlApp);
|
||||
requestObject.put("urlDing",urlDing);
|
||||
|
||||
JSONArray taskObjectList = new JSONArray();
|
||||
String sql = requestBaseInfoUtil.getTodoSql(requestid);
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
String loginid = rs.getString("loginid");
|
||||
String staffid = rs.getString("staffid") ;
|
||||
|
||||
JSONObject taskObject = new JSONObject();
|
||||
taskObject.put("objectAction", "0");
|
||||
taskObject.put("objectType", "0");
|
||||
taskObject.put("objectCode", loginid);
|
||||
taskObject.put("objectId", staffid);
|
||||
taskObject.put("operatorCode", loginid);
|
||||
taskObjectList.add(taskObject);
|
||||
}
|
||||
requestObject.put("taskObjectList",taskObjectList);
|
||||
|
||||
String auth = username + ":" + passwd;
|
||||
bb.writeLog("monitorIntervention---requestObject:"+requestObject.toJSONString());
|
||||
String msgdata = httpRequestUtil.doPostByAuth(portal_todourl,requestObject.toJSONString(),auth);
|
||||
|
||||
if (!"".equals(msgdata)) {
|
||||
JSONObject msgObject = JSONObject.parseObject(msgdata);
|
||||
if (msgObject.containsKey("resultCode")) {
|
||||
String resultCode = msgObject.getString("resultCode");
|
||||
if ("0".equals(resultCode)) {
|
||||
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2(requestid,currentNodeId,currentNodeName,currentUserId,requestObject.toJSONString(),resultCode,"",zhjkbs,nextNodeUserIds);
|
||||
}else{
|
||||
String resultmsg = msgObject.getString("resultMsg");
|
||||
sendPortalErrorUtil.doRecordPortalErrorInfo4Phase2(requestid,currentNodeId,currentNodeName,currentUserId,requestObject.toJSONString(),resultCode,resultmsg,zhjkbs,nextNodeUserIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
bb.writeLog("monitorIntervention-e:"+e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param messageTitle
|
||||
* @return
|
||||
*/
|
||||
private String getShortMessageTitle(String messageTitle) {
|
||||
if (messageTitle.length() > 20) {
|
||||
messageTitle = messageTitle.substring(0, 17) + "...";
|
||||
}
|
||||
return messageTitle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param user
|
||||
* @param copyList
|
||||
* @param forwardList
|
||||
*/
|
||||
public void completeRemark89ForwardByIntervention(User user, List<Map<String,String>> copyList, List<Map<String,String>> forwardList, String note){
|
||||
|
||||
BaseBean bb = new BaseBean();
|
||||
String loginid = user.getLoginid()+"" ;
|
||||
try{
|
||||
RequestInterventionRemark89SendPortalUtil requestInterventionRemark89SendPortalUtil = new RequestInterventionRemark89SendPortalUtil();
|
||||
bb.writeLog("copyList:"+copyList.size());
|
||||
if(copyList.size() >0){
|
||||
String notes = note +"删除未读的抄送数据";
|
||||
requestInterventionRemark89SendPortalUtil.requestInterventionByRemark89(copyList,loginid,notes);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
bb.writeLog("deleteRequestById-ClassNotFoundException"+e);
|
||||
}
|
||||
|
||||
try{
|
||||
RequestInterventionForwardSendPortalUtil requestInterventionForwardSendPortalUtil = new RequestInterventionForwardSendPortalUtil();
|
||||
bb.writeLog("forwardList:"+forwardList.size());
|
||||
if(forwardList.size() >0){
|
||||
String notes = note +"删除未读的转发数据";
|
||||
requestInterventionForwardSendPortalUtil.requestInterventionByForward(forwardList,loginid,notes);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
bb.writeLog("operate3typeByList:"+e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package weaver.interfaces.dito.mq;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.rocketmq.client.consumer.listener.*;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class HrmRocketMsgListener2 implements MessageListenerOrderly {
|
||||
|
||||
|
||||
@Override
|
||||
public ConsumeOrderlyStatus consumeMessage(List<MessageExt> msgs, ConsumeOrderlyContext consumeOrderlyContext) {
|
||||
|
||||
HrmRocketmqUtil hrmRocketmqUtil = new HrmRocketmqUtil();
|
||||
BaseBean bb = new BaseBean();
|
||||
consumeOrderlyContext.setAutoCommit(true);
|
||||
for (MessageExt msg : msgs) {
|
||||
// 可以看到每个queue有唯一的consume线程来消费, 订单对每个queue(分区)有序
|
||||
bb.writeLog("consumeThread=" + Thread.currentThread().getName() + "queueId=" + msg.getQueueId() + ", content:" + new String(msg.getBody()));
|
||||
String msgdata = "";
|
||||
try {
|
||||
msgdata = new String(msg.getBody(),"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(StringUtils.isNotBlank(msgdata))
|
||||
{
|
||||
int errcount = hrmRocketmqUtil.updateOrgData(msgdata);
|
||||
bb.writeLog("Consumer---errcount---:"+errcount);
|
||||
}else{
|
||||
bb.writeLog("Consumer---msgdata---is null ");
|
||||
}
|
||||
}
|
||||
return ConsumeOrderlyStatus.SUCCESS;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,199 @@
|
||||
package weaver.interfaces.dito.mq;
|
||||
|
||||
|
||||
import com.time.util.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
public class MqManagerUpdateCronJob extends BaseCronJob {
|
||||
@Override
|
||||
public void execute() {
|
||||
updateManagerData2Day();
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
*/
|
||||
public void updateManagerData2Day(){
|
||||
BaseBean bb = new BaseBean();
|
||||
LocalDate now = LocalDate.now();
|
||||
|
||||
// LocalDate updDays = now.minusDays(4);
|
||||
// bb.writeLog("updDays4:"+updDays.toString());
|
||||
// updateManagerData(updDays.toString());
|
||||
//
|
||||
// updDays = now.minusDays(3);
|
||||
// bb.writeLog("updDays3:"+updDays.toString());
|
||||
// updateManagerData(updDays.toString());
|
||||
//
|
||||
// updDays = now.minusDays(2);
|
||||
// bb.writeLog("updDays2:"+updDays.toString());
|
||||
// updateManagerData(updDays.toString());
|
||||
//
|
||||
// updDays = now.minusDays(1);
|
||||
// bb.writeLog("updDays1:"+updDays.toString());
|
||||
// updateManagerData(updDays.toString());
|
||||
|
||||
bb.writeLog("now:"+now.toString());
|
||||
updateManagerData_Day(now.toString());
|
||||
}
|
||||
/***
|
||||
*
|
||||
*/
|
||||
// public void updateManagerData(String nowDate){
|
||||
// RecordSet rs = new RecordSet();
|
||||
// RecordSet rs2 = new RecordSet();
|
||||
// BaseBean bb = new BaseBean();
|
||||
// String uftable = "uf_managerunenforced" ;
|
||||
// String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
|
||||
// try{
|
||||
// List<Map<String,String>> dataList = new ArrayList<Map<String,String>>();
|
||||
// String modesql = " select id,personid,managerid from "+uftable+" where startdate <='"+nowDate+"' and (case when char_length(trim(enddate)) > 0 then enddate else '2999-12-31' end) >='"+nowDate +"' and ifnull(sfsx,0) = 0 and ifnull(sfgx,0)=0 order by (case when char_length(trim(enddate)) > 0 then enddate else '2999-12-31' end) ";
|
||||
// bb.writeLog("modesql:"+modesql);
|
||||
// rs.executeQuery(modesql);
|
||||
// while (rs.next()){
|
||||
// String personid = Util.null2String(rs.getString("personid"));
|
||||
// String managerid = Util.null2String(rs.getString("managerid"));
|
||||
// String id = Util.null2String(rs.getString("id"));
|
||||
//
|
||||
// Map<String,String> dataMap = new HashMap<String,String>();
|
||||
// dataMap.put("id",id);
|
||||
// dataMap.put("personid",personid);
|
||||
// dataMap.put("managerid",managerid);
|
||||
// dataList.add(dataMap);
|
||||
// }
|
||||
//
|
||||
// bb.writeLog("updateManagerData:dataList:"+dataList.size());
|
||||
//
|
||||
// for(int i=0;i<dataList.size();i++){
|
||||
//
|
||||
// Map<String,String> dataMap = dataList.get(i);
|
||||
// String personid = Util.null2String(dataMap.get("personid"));
|
||||
// String managerid = Util.null2String(dataMap.get("managerid"));
|
||||
// String id = Util.null2String(dataMap.get("id"));
|
||||
// String sql2 = " update hrmresource set managerid ="+managerid+" where id ="+personid;
|
||||
// boolean isTrue = rs.executeUpdate(sql2);
|
||||
// bb.writeLog("updateManagerData:sql2:"+sql2 +" "+isTrue);
|
||||
// if(isTrue){
|
||||
// int manageridcount = 0;
|
||||
// String sql3 = "select managerid from hrmresource where id = "+personid;
|
||||
// rs2.executeQuery(sql3);
|
||||
// if(rs2.next()){
|
||||
// String hrmmanagerid = Util.null2String(rs2.getString("managerid"));
|
||||
// if(managerid.equals(hrmmanagerid)){
|
||||
// manageridcount++;
|
||||
// }
|
||||
// }
|
||||
// bb.writeLog("manageridcount:"+manageridcount);
|
||||
//
|
||||
// if(manageridcount == 0){
|
||||
// String sql4 = " update hrmresource set managerid ="+managerid+" where id ="+personid;
|
||||
// isTrue = rs2.executeUpdate(sql4);
|
||||
// bb.writeLog("updateManagerData:isTrue:"+isTrue);
|
||||
// }
|
||||
//
|
||||
// String upSql = sql2.replace("'","");
|
||||
// String sql5 = " update "+uftable+" set sfgx = 1,gxsj='"+processTime+"',gxsq='"+upSql+"',sfyz='"+manageridcount+"' where id = "+id ;
|
||||
// rs2.executeUpdate(sql5);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }catch (Exception e){
|
||||
// bb.writeLog("e:"+e);
|
||||
// }
|
||||
// }
|
||||
|
||||
/***
|
||||
*
|
||||
* @param nowDate
|
||||
*/
|
||||
public void updateManagerData_Day(String nowDate){
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
String uftable = "uf_managerunenforced" ;
|
||||
ResourceComInfo resourceComInfo = null;
|
||||
|
||||
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
try{
|
||||
resourceComInfo = new ResourceComInfo();
|
||||
List<Map<String,String>> dataList = new ArrayList<Map<String,String>>();
|
||||
String modesql = " select id,personid,managerid from "+uftable+" where startdate <='"+nowDate+"' and (case when char_length(trim(enddate)) > 0 then enddate else '2999-12-31' end) >='"+nowDate +"' and ifnull(sfsx,0) = 0 and ifnull(sfgx,0)=0 order by (case when char_length(trim(enddate)) > 0 then enddate else '2999-12-31' end) ";
|
||||
bb.writeLog("modesql:"+modesql);
|
||||
rs.executeQuery(modesql);
|
||||
while (rs.next()){
|
||||
String personid = Util.null2String(rs.getString("personid"));
|
||||
String managerid = Util.null2String(rs.getString("managerid"));
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
|
||||
Map<String,String> dataMap = new HashMap<String,String>();
|
||||
dataMap.put("id",id);
|
||||
dataMap.put("personid",personid);
|
||||
dataMap.put("managerid",managerid);
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
|
||||
for(int i=0;i<dataList.size();i++){
|
||||
|
||||
Map<String,String> dataMap = dataList.get(i);
|
||||
String personid = Util.null2String(dataMap.get("personid"));
|
||||
String managerid = Util.null2String(dataMap.get("managerid"));
|
||||
String id = Util.null2String(dataMap.get("id"));
|
||||
String sql2 = " update hrmresource set managerid ="+managerid+" where id ="+personid;
|
||||
boolean isTrue = rs.executeUpdate(sql2);
|
||||
bb.writeLog("updateManagerData:sql2:"+sql2 +" "+isTrue);
|
||||
if(isTrue){
|
||||
int manageridcount = 0;
|
||||
String sql3 = "select managerid from hrmresource where id = "+personid;
|
||||
rs2.executeQuery(sql3);
|
||||
if(rs2.next()){
|
||||
String hrmmanagerid = Util.null2String(rs2.getString("managerid"));
|
||||
bb.writeLog("hrmmanagerid:"+hrmmanagerid);
|
||||
if(managerid.equals(hrmmanagerid)){
|
||||
manageridcount++;
|
||||
}
|
||||
}
|
||||
bb.writeLog("manageridcount:"+manageridcount);
|
||||
|
||||
if(manageridcount == 0){
|
||||
String sql4 = " update hrmresource set managerid ="+managerid+" where id ="+personid;
|
||||
isTrue = rs2.executeUpdate(sql4);
|
||||
bb.writeLog("updateManagerData:isTrue:"+isTrue);
|
||||
}
|
||||
|
||||
String upSql = sql2.replace("'","");
|
||||
String sql5 = " update "+uftable+" set sfgx = 1,gxsj='"+processTime+"',gxsq='"+upSql+"',sfyz='"+manageridcount+"' where id = "+id ;
|
||||
isTrue = rs2.executeUpdate(sql5);
|
||||
bb.writeLog(sql5+" isTrue5:"+isTrue);
|
||||
|
||||
String sql6 = " update "+uftable+" set sfsx = 1 where personid ='"+personid+"' and char_length(trim(enddate)) > 0 and enddate < '"+nowDate+"'";
|
||||
isTrue = rs.executeUpdate(sql6);
|
||||
bb.writeLog(sql6+" isTrue6:"+isTrue);
|
||||
}
|
||||
}
|
||||
resourceComInfo.removeResourceCache();
|
||||
|
||||
MqManagerUpdateRunnable MqManagerUpdateRunnable = new MqManagerUpdateRunnable(dataList);
|
||||
new Thread(MqManagerUpdateRunnable).start();
|
||||
|
||||
}catch (Exception e){
|
||||
bb.writeLog("e:"+e);
|
||||
}
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// LocalDate now = LocalDate.now();
|
||||
// for(int i=0;i<=6;i++){
|
||||
// LocalDate sevenDaysAgo = now.minusDays(6-i);
|
||||
// System.out.println(sevenDaysAgo.toString());
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package weaver.interfaces.dito.mq;
|
||||
|
||||
|
||||
import com.time.util.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MqManagerUpdateRunnable implements Runnable {
|
||||
|
||||
private List<Map<String,String>> dataList = new ArrayList<Map<String,String>>();
|
||||
|
||||
public MqManagerUpdateRunnable(List<Map<String,String>> dataList){
|
||||
this.dataList = dataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
RecordSet rs = new RecordSet();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
String uftable = "uf_managerunenforced" ;
|
||||
bb.writeLog("MqManagerUpdateRunnable:dataList:"+dataList.size());
|
||||
String processTime = DateUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
ResourceComInfo resourceComInfo = null;
|
||||
|
||||
try{
|
||||
|
||||
LocalDate now = LocalDate.now();
|
||||
String nowDate = now.toString();
|
||||
|
||||
resourceComInfo = new ResourceComInfo();
|
||||
|
||||
for(int i=0;i<dataList.size();i++){
|
||||
|
||||
Map<String,String> dataMap = dataList.get(i);
|
||||
String personid = Util.null2String(dataMap.get("personid"));
|
||||
String managerid = Util.null2String(dataMap.get("managerid"));
|
||||
String id = Util.null2String(dataMap.get("id"));
|
||||
String sql2 = " update hrmresource set managerid ="+managerid+" where id ="+personid;
|
||||
boolean isTrue = rs.executeUpdate(sql2);
|
||||
bb.writeLog("updateManagerData:sql2:"+sql2 +" "+isTrue);
|
||||
if(isTrue){
|
||||
int manageridcount = 0;
|
||||
String sql3 = "select managerid from hrmresource where id = "+personid;
|
||||
rs2.executeQuery(sql3);
|
||||
if(rs2.next()){
|
||||
String hrmmanagerid = Util.null2String(rs2.getString("managerid"));
|
||||
bb.writeLog("hrmmanagerid:"+hrmmanagerid);
|
||||
if(managerid.equals(hrmmanagerid)){
|
||||
manageridcount++;
|
||||
}
|
||||
}
|
||||
bb.writeLog("manageridcount:"+manageridcount);
|
||||
|
||||
if(manageridcount == 0){
|
||||
String sql4 = " update hrmresource set managerid ="+managerid+" where id ="+personid;
|
||||
isTrue = rs2.executeUpdate(sql4);
|
||||
bb.writeLog("updateManagerData:isTrue:"+isTrue);
|
||||
}
|
||||
|
||||
String upSql = sql2.replace("'","");
|
||||
String sql5 = " update "+uftable+" set sfgx = 1,gxsj='"+processTime+"',gxsq='"+upSql+"',sfyz='"+manageridcount+"' where id = "+id ;
|
||||
isTrue = rs2.executeUpdate(sql5);
|
||||
bb.writeLog(sql5+" isTrue5:"+isTrue);
|
||||
|
||||
String sql6 = " update "+uftable+" set sfsx = 1 where personid ='"+personid+"' and char_length(trim(enddate)) > 0 and enddate < '"+nowDate+"'";
|
||||
isTrue = rs.executeUpdate(sql6);
|
||||
bb.writeLog(sql6+" isTrue6:"+isTrue);
|
||||
}
|
||||
}
|
||||
|
||||
resourceComInfo.removeResourceCache();
|
||||
}catch (Exception e){
|
||||
bb.writeLog("MqManagerUpdateRunnable:e:"+e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package weaver.interfaces.dito.mq;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.rocketmq.client.consumer.listener.*;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class RocketMsgListener2 implements MessageListenerOrderly {
|
||||
|
||||
@Override
|
||||
public ConsumeOrderlyStatus consumeMessage(List<MessageExt> list, ConsumeOrderlyContext consumeOrderlyContext) {
|
||||
BaseBean bb = new BaseBean();
|
||||
// MessageExt msg = list.get(0);
|
||||
|
||||
RocketmqUtil rocketmqUtil = new RocketmqUtil();
|
||||
|
||||
try {
|
||||
for(MessageExt msg : list){
|
||||
bb.writeLog("Consumer---3----"+new String(msg.getBody()));
|
||||
String msgdata = new String(msg.getBody(),"UTF-8");
|
||||
if(StringUtils.isNotBlank(msgdata))
|
||||
{
|
||||
String data = msgdata.substring(msgdata.indexOf("{"));
|
||||
int errcount = rocketmqUtil.updateOrgData(data);
|
||||
bb.writeLog("Consumer---errcount---:"+errcount);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
bb.writeLog("Consumer---UnsupportedEncodingException---e:"+e);
|
||||
return ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT;
|
||||
}
|
||||
return ConsumeOrderlyStatus.SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package weaver.interfaces.dito.remark;
|
||||
|
||||
import com.time.util.DateUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
public class UpdateRequestRemarkViewDateRunnable implements Runnable{
|
||||
|
||||
private String requestid;
|
||||
private String userid;
|
||||
private String preisremark;
|
||||
public UpdateRequestRemarkViewDateRunnable(String requestid, String userid, String preisremark){
|
||||
this.requestid = requestid;
|
||||
this.userid = userid;
|
||||
this.preisremark = preisremark;
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
try{
|
||||
String viewDate = DateUtil.getCurrentTime("yyyy-MM-dd");
|
||||
String viewTime = DateUtil.getCurrentTime("HH:mm:ss");
|
||||
|
||||
bb.writeLog("updateCurrentoperatorRemark-requestid:"+requestid);
|
||||
if(StringUtils.isNotBlank(requestid)){
|
||||
String sql = " update workflow_currentoperator set isremark=2,viewtype=-2,viewdate=(case when viewdate is not null then viewdate else '"+viewDate+"' end),viewtime=(case when viewtime is not null then viewtime else '"+viewTime+"' end) where requestid = "+requestid +" and preisremark in ("+preisremark+") and userid in("+userid+")";
|
||||
boolean isTrue = rs.executeUpdate(sql);
|
||||
bb.writeLog("updateCurrentoperatorRemark-sql:"+sql +" isTrue:"+isTrue);
|
||||
}
|
||||
}catch (Exception e){
|
||||
bb.writeLog("updateCurrentoperatorRemark-e:"+e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,195 @@
|
||||
package weaver.interfaces.dito.submit;
|
||||
|
||||
import com.customization.dito.sendtodo.RequestBaseInfoUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RequestSubmitQueryPortalUtil {
|
||||
|
||||
private RequestBaseInfoUtil requestBaseInfoUtil = new RequestBaseInfoUtil();
|
||||
/**
|
||||
*
|
||||
* @param requestid
|
||||
*/
|
||||
public List<Map<String,String>> queryRequestReamrk89BySubmit(String requestid,String currentUserid){
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("queryRequestReamrk8ByDelete-requestid:"+requestid);
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
try{
|
||||
if(StringUtils.isNotBlank(requestid)){
|
||||
if(StringUtils.isNotBlank(requestid)){
|
||||
String sql =" select t.userid,t.nodeid,t.requestid,t2.nodename,t1.requestname,t3.workflowname,h2.loginid\n" +
|
||||
" from workflow_currentoperator t\n" +
|
||||
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
|
||||
" left join (select id,lastname,loginid from hrmresource union all select id,lastname,loginid from hrmresourcemanager ) h2 on h2.id = t1.creater \n" +
|
||||
" left join workflow_nodebase t2 on t2.id = t.nodeid \n" +
|
||||
" left join workflow_base t3 on t3.id = t1.workflowid\n" +
|
||||
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
|
||||
" and t.preisremark not in (8,9)\n" +
|
||||
" and t.requestid in("+requestid +") " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
bb.writeLog("queryWorkflowCopyToByRequestid-sql:"+sql);
|
||||
|
||||
while (rs.next()){
|
||||
String nodeid = Util.null2String(rs.getString("nodeid"));
|
||||
String userid = Util.null2String(rs.getString("userid"));
|
||||
String nodename = Util.null2String(rs.getString("nodename"));
|
||||
String workflowname = Util.null2String(rs.getString("workflowname")) ;
|
||||
String requestname = Util.null2String(rs.getString("requestname")) ;
|
||||
String lcid = Util.null2String(rs.getString("requestid")) ;
|
||||
String creater = Util.null2String(rs.getString("loginid")) ;
|
||||
|
||||
Map<String,String> map = new HashMap<String, String>();
|
||||
map.put("requestid",requestid);
|
||||
map.put("userid",userid);
|
||||
map.put("nodeid",nodeid);
|
||||
map.put("nodename",nodename);
|
||||
map.put("workflowname",workflowname);
|
||||
map.put("requestname",requestname);
|
||||
map.put("lcid",lcid);
|
||||
map.put("creater",creater);
|
||||
list.add(map);
|
||||
}
|
||||
bb.writeLog("queryWorkflowCopyToByRequestid-list:"+list.size());
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Map<String,String>> queryRequestForwardBySubmit(String requestid,String currentUserid){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("queryRequestForwardByDelete-requestid:"+requestid);
|
||||
|
||||
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
|
||||
|
||||
try{
|
||||
if(StringUtils.isNotBlank(requestid)){
|
||||
String sql =" select t.userid,t.nodeid,t.requestid,t2.nodename,t1.requestname,t3.workflowname,h2.loginid\n" +
|
||||
" from workflow_currentoperator t\n" +
|
||||
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
|
||||
" left join (select id,lastname,loginid from hrmresource union all select id,lastname,loginid from hrmresourcemanager ) h2 on h2.id = t1.creater \n" +
|
||||
" left join workflow_nodebase t2 on t2.id = t.nodeid \n" +
|
||||
" left join workflow_base t3 on t3.id = t1.workflowid\n" +
|
||||
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
|
||||
" and t.preisremark = 1 \n" +
|
||||
" and t.requestid in("+requestid +") " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
bb.writeLog("queryWorkflowForwardByRequestid-sql:"+sql);
|
||||
|
||||
while (rs.next()){
|
||||
String nodeid = Util.null2String(rs.getString("nodeid"));
|
||||
String userid = Util.null2String(rs.getString("userid"));
|
||||
String nodename = Util.null2String(rs.getString("nodename"));
|
||||
String workflowname = Util.null2String(rs.getString("workflowname")) ;
|
||||
String requestname = Util.null2String(rs.getString("requestname")) ;
|
||||
String lcid = Util.null2String(rs.getString("requestid")) ;
|
||||
String creater = Util.null2String(rs.getString("loginid")) ;
|
||||
|
||||
Map<String,String> map = new HashMap<String, String>();
|
||||
map.put("requestid",requestid);
|
||||
map.put("userid",userid);
|
||||
map.put("nodeid",nodeid);
|
||||
map.put("nodename",nodename);
|
||||
map.put("workflowname",workflowname);
|
||||
map.put("requestname",requestname);
|
||||
map.put("lcid",lcid);
|
||||
map.put("creater",creater);
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> queryRequestAtBySubmit(String requestid,String currentUserid){
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("queryRequestAtByDelete-requestid:"+requestid);
|
||||
|
||||
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
try{
|
||||
if (StringUtils.isNotBlank(requestid)) {
|
||||
String sql =" select t.userid,t.nodeid,t.requestid,t2.nodename,t1.requestname,t3.workflowname,h2.loginid\n" +
|
||||
" from workflow_currentoperator t\n" +
|
||||
" inner join workflow_requestbase t1 on t.requestid = t1.requestid\n" +
|
||||
" left join (select id,lastname,loginid from hrmresource union all select id,lastname,loginid from hrmresourcemanager ) h2 on h2.id = t1.creater \n" +
|
||||
" left join workflow_nodebase t2 on t2.id = t.nodeid \n" +
|
||||
" left join workflow_base t3 on t3.id = t1.workflowid\n" +
|
||||
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
|
||||
" and t.preisremark in (18) \n" +
|
||||
" and t.requestid in("+requestid +") " ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
bb.writeLog("queryWorkflowAtByRequestid-sql:"+sql);
|
||||
|
||||
while (rs.next()){
|
||||
String nodeid = Util.null2String(rs.getString("nodeid"));
|
||||
String userid = Util.null2String(rs.getString("userid"));
|
||||
String nodename = Util.null2String(rs.getString("nodename"));
|
||||
String workflowname = Util.null2String(rs.getString("workflowname")) ;
|
||||
String requestname = Util.null2String(rs.getString("requestname")) ;
|
||||
String lcid = Util.null2String(rs.getString("requestid")) ;
|
||||
String creater = Util.null2String(rs.getString("loginid")) ;
|
||||
|
||||
Map<String,String> map = new HashMap<String, String>();
|
||||
map.put("requestid",requestid);
|
||||
map.put("userid",userid);
|
||||
map.put("nodeid",nodeid);
|
||||
map.put("nodename",nodename);
|
||||
map.put("workflowname",workflowname);
|
||||
map.put("requestname",requestname);
|
||||
map.put("lcid",lcid);
|
||||
map.put("creater",creater);
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Map<String,String>> queryRequestDataByDelete(String requestids,String currentUserid){
|
||||
RecordSet rs = new RecordSet();
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("queryRequestDataByDelete-requestid:"+requestids);
|
||||
|
||||
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
try{
|
||||
if (StringUtils.isNotBlank(requestids)) {
|
||||
String[] requestid = requestids.split(",");
|
||||
for(int i=0;i<requestid.length;i++){
|
||||
|
||||
Map<String,String> baseMap = requestBaseInfoUtil.queryRequestBaseByRequestid(requestid[i]);
|
||||
list.add(baseMap);
|
||||
}
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package weaver.interfaces.dito.util.okhttp;
|
||||
|
||||
import okhttp3.*;
|
||||
import okio.Buffer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
|
||||
public class NetworkIntercepter implements Interceptor{
|
||||
private static Logger LOGGER = LoggerFactory.getLogger(NetworkIntercepter.class);
|
||||
@Override
|
||||
public Response intercept(Interceptor.Chain chain) {
|
||||
long start = System.currentTimeMillis();
|
||||
Response response=null;
|
||||
String responseBody = null;
|
||||
String responseCode = null;
|
||||
String url = null;
|
||||
String requestBody = null;
|
||||
try {
|
||||
Request request = chain.request();
|
||||
url = request.url().toString();
|
||||
requestBody = getRequestBody(request);
|
||||
response = chain.proceed(request);
|
||||
responseBody = response.body().string();
|
||||
responseCode = String.valueOf(response.code());
|
||||
MediaType mediaType = response.body().contentType();
|
||||
response = response.newBuilder().body(ResponseBody.create(mediaType,responseBody)).build();
|
||||
}
|
||||
catch (Exception e){
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
finally {
|
||||
long end = System.currentTimeMillis();
|
||||
String duration = String.valueOf(end - start);
|
||||
LOGGER.info("responseTime= {}, requestUrl= {}, params={}, responseCode= {}, result= {}",
|
||||
duration, url,requestBody,responseCode,responseBody);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private String getRequestBody(Request request) {
|
||||
String requestContent = "";
|
||||
if (request == null) {
|
||||
return requestContent;
|
||||
}
|
||||
RequestBody requestBody = request.body();
|
||||
if (requestBody == null) {
|
||||
return requestContent;
|
||||
}
|
||||
try {
|
||||
Buffer buffer = new Buffer();
|
||||
requestBody.writeTo(buffer);
|
||||
Charset charset = Charset.forName("utf-8");
|
||||
requestContent = buffer.readString(charset);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return requestContent;
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package weaver.interfaces.dito.util.okhttp;
|
||||
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class OkHttpUtils {
|
||||
private static final int CONNECTION_TIME_OUT = 2000;//连接超时时间
|
||||
private static final int SOCKET_TIME_OUT = 2000;//读写超时时间
|
||||
private static final int MAX_IDLE_CONNECTIONS = 30;// 空闲连接数
|
||||
private static final long KEEP_ALLIVE_TIME = 60000L;//保持连接时间
|
||||
|
||||
private OkHttpClient okHttpClient;
|
||||
private volatile static OkHttpUtils okhttpUtils;
|
||||
|
||||
public static OkHttpUtils getInstance(){
|
||||
if(okhttpUtils == null){
|
||||
synchronized(OkHttpUtils.class){
|
||||
if(okhttpUtils == null){
|
||||
okhttpUtils = new OkHttpUtils();
|
||||
}
|
||||
}
|
||||
}
|
||||
return okhttpUtils;
|
||||
}
|
||||
|
||||
public OkHttpUtils(){
|
||||
ConnectionPool connectionPool = new ConnectionPool(MAX_IDLE_CONNECTIONS,KEEP_ALLIVE_TIME, TimeUnit.MILLISECONDS);
|
||||
this.okHttpClient = new OkHttpClient()
|
||||
.newBuilder()
|
||||
.readTimeout(SOCKET_TIME_OUT, TimeUnit.MILLISECONDS)
|
||||
.writeTimeout(SOCKET_TIME_OUT, TimeUnit.MILLISECONDS)
|
||||
.connectionPool(connectionPool)
|
||||
.retryOnConnectionFailure(false) //自动重连设置为false
|
||||
.connectTimeout(CONNECTION_TIME_OUT,TimeUnit.MILLISECONDS)
|
||||
.addInterceptor(new RetryIntercepter(2)) //重试拦截器2次
|
||||
.addNetworkInterceptor(new NetworkIntercepter()) //网络拦截器,统一打印日志
|
||||
.build();
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package weaver.interfaces.dito.util.okhttp;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class RetryIntercepter implements Interceptor{
|
||||
public int maxRetryCount;
|
||||
private int count = 0;
|
||||
public RetryIntercepter(int maxRetryCount) {
|
||||
this.maxRetryCount = maxRetryCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
|
||||
return retry(chain);
|
||||
}
|
||||
|
||||
public Response retry(Chain chain){
|
||||
Response response = null;
|
||||
Request request = chain.request();
|
||||
try {
|
||||
response = chain.proceed(request);
|
||||
while (!response.isSuccessful() && count < maxRetryCount) {
|
||||
count++;
|
||||
response = retry(chain);
|
||||
}
|
||||
}
|
||||
catch (Exception e){
|
||||
while (count < maxRetryCount){
|
||||
count++;
|
||||
response = retry(chain);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package weaver.interfaces.dito.wait;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class RequestWaitNodeUtil {
|
||||
|
||||
public void isWaitNode(String requestid) {
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("sendTodoDataByReject");
|
||||
|
||||
Map<String,String> baseMap = queryRequestBaseByRequestid(requestid);
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> queryRequestBaseByRequestid(String requestid){
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String,String> baseMap = new HashMap<String,String>();
|
||||
String requestname = "";
|
||||
String currentnodeid = "";
|
||||
String currentnodetype = "";
|
||||
|
||||
try{
|
||||
String sql =" select t1.requestname,t1.currentnodetype,t1.currentnodeid" +
|
||||
" from workflow_requestbase t1\n" +
|
||||
" where (t1.deleted <> 1 or t1.deleted is null or t1.deleted = '')\n" +
|
||||
" and t1.requestid = "+requestid ;
|
||||
|
||||
rs.executeQuery(sql);
|
||||
if (rs.next()){
|
||||
requestname = Util.null2String(rs.getString("requestname")) ;
|
||||
currentnodeid = Util.null2String(rs.getString("currentnodeid")) ;
|
||||
currentnodetype = Util.null2String(rs.getString("currentnodetype")) ;
|
||||
baseMap.put("requestname",requestname);
|
||||
baseMap.put("currentnodeid",currentnodeid);
|
||||
baseMap.put("currentnodetype",currentnodetype);
|
||||
baseMap.put("requestid",requestid);
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return baseMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue