init
This commit is contained in:
parent
94ab8bf4f1
commit
f2b56fedeb
|
|
@ -1,11 +1,11 @@
|
|||
package com.engine.workflow.cmd.requestForm.remind;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.GCONST;
|
||||
|
|
@ -14,8 +14,8 @@ import weaver.hrm.User;
|
|||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 邮件提醒候取链接
|
||||
|
|
@ -26,7 +26,7 @@ public class GetEmailRemindUrlCmd extends AbstractCommonCommand<Map<String, Obje
|
|||
protected String requestName;
|
||||
protected String requestId;
|
||||
|
||||
public GetEmailRemindUrlCmd(User user, Map<String,Object> params, String requestId, String requestName) {
|
||||
public GetEmailRemindUrlCmd(User user, Map<String, Object> params, String requestId, String requestName) throws UnsupportedEncodingException {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.requestId = requestId;
|
||||
|
|
@ -35,57 +35,83 @@ public class GetEmailRemindUrlCmd extends AbstractCommonCommand<Map<String, Obje
|
|||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
BaseBean baseBean =new BaseBean();
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
if(Strings.isNullOrEmpty(requestName)){
|
||||
if (Strings.isNullOrEmpty(requestName)) {
|
||||
rs.executeQuery("select requestNameNew from workflow_requestbase where requestid = ?", requestId);
|
||||
rs.next();
|
||||
requestName = rs.getString(1);
|
||||
}
|
||||
String emailLink = "("+requestName+")";
|
||||
String emailLink = "(" + requestName + ")";
|
||||
|
||||
// 从数据库中取得OAaddress数据作为host
|
||||
rs.executeQuery("select oaaddress from systemset");
|
||||
rs.next();
|
||||
String host = Util.null2String(rs.getString("oaaddress"));
|
||||
baseBean.writeLog("qc1602252---static_host="+host);
|
||||
baseBean.writeLog("qc1602252---static_host=" + host);
|
||||
|
||||
String domain = (String) Util_DataCache.getObjVal("qc1602252"+this.user.getUID());
|
||||
baseBean.writeLog("qc1602252---key="+"qc1602252"+this.user.getUID());
|
||||
baseBean.writeLog("qc1602252---domain="+domain);
|
||||
if(StringUtils.isNotBlank(domain)){
|
||||
host = domain;
|
||||
}else{
|
||||
//找不到人与域名映射的情况,获取requestId映射的域名
|
||||
String requestIdDomain = (String) Util_DataCache.getObjVal("domain"+requestId);
|
||||
baseBean.writeLog("domain---key="+"domain"+requestId);
|
||||
baseBean.writeLog("requestIdDomain="+requestIdDomain);
|
||||
if(StringUtils.isNotBlank(requestIdDomain)){
|
||||
host = requestIdDomain;
|
||||
// String domain = (String) Util_DataCache.getObjVal("qc1602252"+this.user.getUID());
|
||||
// baseBean.writeLog("qc1602252---key="+"qc1602252"+this.user.getUID());
|
||||
// baseBean.writeLog("qc1602252---domain="+domain);
|
||||
// if(StringUtils.isNotBlank(domain)){
|
||||
// host = domain;
|
||||
// }else{
|
||||
// //找不到人与域名映射的情况,获取requestId映射的域名
|
||||
// String requestIdDomain = (String) Util_DataCache.getObjVal("domain"+requestId);
|
||||
// baseBean.writeLog("domain---key="+"domain"+requestId);
|
||||
// baseBean.writeLog("requestIdDomain="+requestIdDomain);
|
||||
// if(StringUtils.isNotBlank(requestIdDomain)){
|
||||
// host = requestIdDomain;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
//为适配移动端,将流程创建人的分部与域名绑定
|
||||
if (StringUtils.isNotBlank(requestId) && !"-1".equals(requestId)) {
|
||||
baseBean.writeLog("qc1602252---requestId=" + requestId);
|
||||
baseBean.writeLog("qc1602252---config=" + SubCompanyName + "--" + Domain + "--" + XXFWSubCompanyName + "--" + XXFWDomain);
|
||||
baseBean.writeLog("qc1602252---requestId=" + requestId);
|
||||
rs.executeQuery("select creater from workflow_requestbase where requestid = ?", requestId);
|
||||
if (rs.next()) {
|
||||
String creater = rs.getString("creater");
|
||||
baseBean.writeLog("qc1602252---requestId creater= " + requestId + "---" + creater);
|
||||
rs.executeQuery("select subcompanyid1 from hrmresource where id = ?", creater);
|
||||
if (rs.next()) {
|
||||
String subcompanyid1 = rs.getString("subcompanyid1");
|
||||
baseBean.writeLog("qc1602252---requestId creater subcompanyid1=" + requestId + "---" + creater + "---" + subcompanyid1);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("subcompanyid1", subcompanyid1);
|
||||
Map<String, String> subcompany = getSubcompany(map);
|
||||
String targetUrl = subcompany.get("targetUrl");
|
||||
host = targetUrl;
|
||||
baseBean.writeLog("qc1602252---" + "---requestId creater lastsubcompanyid1=" + requestId + "---" + creater + "---" + subcompany.get("subcompanyid1"));
|
||||
baseBean.writeLog("qc1602252---requestId creater subcompanyname=" + requestId + "---" + creater + "---" + subcompany.get("subcompanyname"));
|
||||
baseBean.writeLog("qc1602252---requestId creater targetUrl=" + requestId + "---" + creater + "---" + subcompany.get("targetUrl"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!Strings.isNullOrEmpty(host)){
|
||||
if (!Strings.isNullOrEmpty(host)) {
|
||||
String loginPage = "/login/LoginMail.jsp";
|
||||
String gotoPage = "/common/chatResource/view.html?resourcetype=0&resourceid=" + requestId;
|
||||
if(GCONST.getMailReminderSet()){
|
||||
if (GCONST.getMailReminderSet()) {
|
||||
loginPage = Strings.isNullOrEmpty(GCONST.getMailLoginPage()) ? loginPage : GCONST.getMailLoginPage();
|
||||
gotoPage = Strings.isNullOrEmpty(GCONST.getMailGotoPage()) ? gotoPage : GCONST.getMailGotoPage();
|
||||
gotoPage = Strings.isNullOrEmpty(GCONST.getMailGotoPage()) ? gotoPage : GCONST.getMailGotoPage();
|
||||
}
|
||||
try {
|
||||
gotoPage = URLEncoder.encode(gotoPage,"utf-8");
|
||||
//需要编码两次
|
||||
gotoPage = URLEncoder.encode(gotoPage,"utf-8");
|
||||
gotoPage = URLEncoder.encode(gotoPage, "utf-8");
|
||||
//需要编码两次
|
||||
gotoPage = URLEncoder.encode(gotoPage, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String url = String.format("%s?gopage=%s&target=2",loginPage, gotoPage);
|
||||
emailLink = "(<a style='text-decoration: underline; color: blue;cursor:hand' target='_blank' href='"+
|
||||
host + url +" '>"+requestName+"</a>)";
|
||||
String url = String.format("%s?gopage=%s&target=2", loginPage, gotoPage);
|
||||
emailLink = "(<a style='text-decoration: underline; color: blue;cursor:hand' target='_blank' href='" +
|
||||
host + url + " '>" + requestName + "</a>)";
|
||||
}
|
||||
baseBean.writeLog("qc1602252---requestId="+requestId);
|
||||
baseBean.writeLog("qc1602252---emailLink="+emailLink);
|
||||
baseBean.writeLog("qc1602252---requestId=" + requestId);
|
||||
baseBean.writeLog("qc1602252---emailLink=" + emailLink);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("url", emailLink);
|
||||
return result;
|
||||
|
|
@ -95,4 +121,40 @@ public class GetEmailRemindUrlCmd extends AbstractCommonCommand<Map<String, Obje
|
|||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
String SubCompanyName = Util.null2String(new String(Util.null2String(baseBean.getPropValue("SZSM_subcompany_domain_config", "SubCompanyName")).getBytes("ISO-8859-1"), "utf-8")).trim();
|
||||
String Domain = Util.null2String(new String(Util.null2String(baseBean.getPropValue("SZSM_subcompany_domain_config", "Domain")).getBytes("ISO-8859-1"), "utf-8")).trim();
|
||||
String XXFWSubCompanyName = Util.null2String(new String(Util.null2String(baseBean.getPropValue("SZSM_subcompany_domain_config", "XXFWSubCompanyName")).getBytes("ISO-8859-1"), "utf-8")).trim();
|
||||
String XXFWDomain = Util.null2String(new String(Util.null2String(baseBean.getPropValue("SZSM_subcompany_domain_config", "XXFWDomain")).getBytes("ISO-8859-1"), "utf-8")).trim();
|
||||
|
||||
private List<String> SubCompanyNameList = Arrays.stream(SubCompanyName.split(",")).collect(Collectors.toList());
|
||||
private List<String> XXFWSubCompanyNameList = Arrays.stream(XXFWSubCompanyName.split(",")).collect(Collectors.toList());
|
||||
|
||||
private Map<String, String> getSubcompany(Map<String, String> map) {
|
||||
|
||||
Map<String, String> hashMap = Maps.newHashMap();
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select SUPSUBCOMID,SUBCOMPANYNAME from hrmsubcompany where id = ? ", map.get("subcompanyid1"));
|
||||
if (rs.next()) {
|
||||
String subcompanyid1 = rs.getString("SUPSUBCOMID");
|
||||
String subcompanyname = rs.getString("SUBCOMPANYNAME");
|
||||
hashMap.put("subcompanyid1", subcompanyid1);
|
||||
hashMap.put("subcompanyname", subcompanyname);
|
||||
if (SubCompanyNameList.contains(subcompanyname)) {
|
||||
hashMap.put("targetUrl", Domain);
|
||||
return hashMap;
|
||||
} else if (XXFWSubCompanyNameList.contains(subcompanyname)) {
|
||||
hashMap.put("targetUrl", XXFWDomain);
|
||||
return hashMap;
|
||||
} else {
|
||||
if (!map.get("subcompanyid1").equals(hashMap.get("subcompanyid1"))) {
|
||||
return getSubcompany(hashMap);
|
||||
} else {
|
||||
return hashMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.workflow.biz.freeNode.FreeNodeAsyncSubmitBiz;
|
||||
|
|
@ -24,7 +23,6 @@ import com.google.common.base.Strings;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import weaver.filter.WeaverRequest;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -375,30 +373,33 @@ public class RequestFormAction {
|
|||
* @param response
|
||||
*/
|
||||
private void saveDomainCache(HttpServletRequest request, HttpServletResponse response) {
|
||||
BaseBean baseBean = new BaseBean();
|
||||
try{
|
||||
User cuser = HrmUserVarify.getUser(request, response);
|
||||
String scheme = request.getScheme();
|
||||
String serverName= request.getServerName();
|
||||
String domain = scheme +"://"+ serverName ;
|
||||
int port= request.getServerPort();
|
||||
if(port != 80){
|
||||
domain = domain +":" + port;
|
||||
}
|
||||
Util_DataCache.setObjVal("qc1602252"+cuser.getUID() , domain);
|
||||
|
||||
//解决自动审批时,当前处理人获取不到,故将requestid与域名映射
|
||||
String requestid = request.getParameter("requestid");
|
||||
if(StringUtils.isNotBlank(requestid)&&!"-1".equals(requestid)){
|
||||
Util_DataCache.setObjVal("domain"+requestid , domain);
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
baseBean.writeLog("qc1602252---saveDomainCache---error");
|
||||
baseBean.writeLog(e);
|
||||
}
|
||||
// BaseBean baseBean = new BaseBean();
|
||||
// try{
|
||||
// User cuser = HrmUserVarify.getUser(request, response);
|
||||
// String scheme = request.getScheme();
|
||||
// String serverName= request.getServerName();
|
||||
// String domain = scheme +"://"+ serverName ;
|
||||
// int port= request.getServerPort();
|
||||
// if(port != 80){
|
||||
// domain = domain +":" + port;
|
||||
// }
|
||||
// Util_DataCache.setObjVal("qc1602252"+cuser.getUID() , domain);
|
||||
//
|
||||
// //解决自动审批时,当前处理人获取不到,故将requestid与域名映射
|
||||
// String requestid = request.getParameter("requestid");
|
||||
// if(StringUtils.isNotBlank(requestid)&&!"-1".equals(requestid)){
|
||||
// Util_DataCache.setObjVal("domain"+requestid , domain);
|
||||
// }
|
||||
//
|
||||
// }catch (Exception e){
|
||||
// baseBean.writeLog("qc1602252---saveDomainCache---error");
|
||||
// baseBean.writeLog(e);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 转发、转办、意见征询等提交
|
||||
**/
|
||||
|
|
|
|||
Loading…
Reference in New Issue