init
This commit is contained in:
parent
7d440ce005
commit
3d12b4bbd0
|
|
@ -0,0 +1,98 @@
|
|||
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 weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 邮件提醒候取链接
|
||||
* Created by wcc on 2019/7/2.
|
||||
*/
|
||||
public class GetEmailRemindUrlCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
protected String requestName;
|
||||
protected String requestId;
|
||||
|
||||
public GetEmailRemindUrlCmd(User user, Map<String,Object> params, String requestId, String requestName) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
this.requestId = requestId;
|
||||
this.requestName = requestName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
BaseBean baseBean =new BaseBean();
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
if(Strings.isNullOrEmpty(requestName)){
|
||||
rs.executeQuery("select requestNameNew from workflow_requestbase where requestid = ?", requestId);
|
||||
rs.next();
|
||||
requestName = rs.getString(1);
|
||||
}
|
||||
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);
|
||||
|
||||
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(!Strings.isNullOrEmpty(host)){
|
||||
String loginPage = "/login/LoginMail.jsp";
|
||||
String gotoPage = "/common/chatResource/view.html?resourcetype=0&resourceid=" + requestId;
|
||||
if(GCONST.getMailReminderSet()){
|
||||
loginPage = Strings.isNullOrEmpty(GCONST.getMailLoginPage()) ? loginPage : GCONST.getMailLoginPage();
|
||||
gotoPage = Strings.isNullOrEmpty(GCONST.getMailGotoPage()) ? gotoPage : GCONST.getMailGotoPage();
|
||||
}
|
||||
try {
|
||||
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>)";
|
||||
}
|
||||
baseBean.writeLog("qc1602252---requestId="+requestId);
|
||||
baseBean.writeLog("qc1602252---emailLink="+emailLink);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("url", emailLink);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue