You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

252 lines
9.2 KiB
Plaintext

<%@ page import="weaver.general.*" %>
<%@page import="weaver.conn.RecordSet"%>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageBean" %>
<%@ page import="com.cloudstore.dev.api.bean.MessageType" %>
<%@ page import="com.cloudstore.dev.api.util.Util_Message" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="weaver.formmode.setup.ModeRightInfo" %>
<%@ page import="com.engine.cube.service.ModeCardService" %>
<%@ page import="com.engine.common.util.ServiceUtil" %>
<%@ page import="com.engine.cube.service.impl.ModCardServiceImpl" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="sun.misc.BASE64Encoder" %>
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="bb" class="weaver.general.BaseBean" scope="page" />
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
JSONObject jsonObject = new JSONObject();
Map<String, Object> apidatas = new HashMap<String, Object>();
User user = HrmUserVarify.getUser (request , response) ;
String billid = "7";
String modeid = "285";
String reqFormid = "-752";
String from = "reply";
String src = "submit";
String iscreate = "1" ;
String isFormMode = "1";
String username = "" ;
String userid = request.getParameter("userid") ;
String anniversary = request.getParameter("rzzn") ;
if(StringUtils.isNotEmpty(userid)){
username = ResourceComInfo.getLastname(userid);
}
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(anniversary)){
String zfy = "亲爱的$userid$,入职$anniversary$周年纪念日快乐!";
zfy = zfy.replace("$userid$",username);
zfy = zfy.replace("$anniversary$",anniversary);
bb.writeLog("zfy:"+zfy);
// out.println("zfy:"+zfy+"</br>");
String zfy2 = new String(zfy.getBytes("UTF-8"),"UTF-8");
String zfy3 = new String(zfy.getBytes("UTF-8"),"GBK");
bb.writeLog("zfy2:"+zfy2);
// out.println("zfy2:"+zfy2+"</br>");
bb.writeLog("zfy3:"+zfy3);
// out.println("zfy3:"+zfy3+"</br>");
String contentHtml ="<p><img alt=\"\" src=\"/weaver/weaver.file.FileDownload?fileid=a8d327495f79525ab3ce9c1523946a05bda9a37a45cd618e62c1d2fb37719793b67dfc4feda14d2054fcd6dab6aa92002069726005eaf18c1\" /></p>\n" +
"<p>&nbsp;</p>\n" +
"<p>"+zfy+"</p> ";
// out.println(contentHtml+"</br>");
BASE64Encoder encoder = new BASE64Encoder();
String replycontent = encoder.encode(contentHtml.getBytes("UTF-8"));
// out.println("encode = " + replycontent);
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("reqModeId",modeid);
paramMap.put("reqBillid",billid);
paramMap.put("reqFormid",reqFormid);
paramMap.put("isFormMode",isFormMode);
paramMap.put("from",from);
paramMap.put("src",src);
paramMap.put("iscreate",iscreate);
paramMap.put("replycontent",replycontent);
paramMap.put("isEditOpt","0");
apidatas.putAll(this.getService(user).replySubmit(paramMap,user));
apidatas.put("status", "1");
jsonObject.put("data",apidatas);
}
// String replycontent = "PHA+PGltZyBhbHQ9IiIgc3JjPSIvd2VhdmVyL3dlYXZlci5maWxlLkZpbGVEb3dubG9hZD9maWxlaWQ9YTdkNTVjZmY4YmI4NTU0NGQ1ODk3MmZkYWQ3YzFiMDAyM2U3ZTczNGZhM2JkZjk4ZjI0ZjdiMzFlMWZkZmFhNDY2MjI5NmNiMDk2NmY5YzI5YTVmOGMyNjFjNTBmYWI5ZTRmNzEwZmJkZGQxNjc2MDMiIC8+PC9wPgoKPHA+Jm5ic3A7PC9wPgoKPHA+Jm5ic3A7PC9wPgoKPHA+Jm5ic3A7PC9wPgoKPHA+eHh4eHh4eDwvcD4K";
jsonObject.put("result",true);
%>
<%=jsonObject.toJSONString() %>
<%!
private ModeCardService getService(User user) {
return (ModeCardService) ServiceUtil.getService(ModCardServiceImpl.class, user);
}
/***
*
* @param
* @param
* @return
*/
private void sendMessageBy(String sendUserId,int smstypeid,String zfy,String uuid) {
String linkUrl = "/spa/custom/static/index.html#/main/cs/app/d598bf2074434c67af3e008d4f9cfe20_anniversaryView?uuid="+uuid;
String linkMobileUrl = "/spa/custom/static/index.html#/main/cs/app/d598bf2074434c67af3e008d4f9cfe20_anniversaryView?uuid="+uuid;
String title = " ";
String content = zfy;
// DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// LocalDate currentDate = LocalDate.now();
// String today = currentDate.format(dateFormatter);
Set<String> userSet = new HashSet<String>();
userSet.add(sendUserId);
sendMessage(smstypeid,userSet,title,content,linkUrl,linkMobileUrl);
}
/***
*
* @param smstypeid
* @param sendIdSet
* @param title
* @param context
* @param linkPcUrl
* @param linkMobileUrl
* @return
*/
public boolean sendMessage(int smstypeid, Set<String> sendIdSet, String title, String context, String linkPcUrl, String linkMobileUrl)
{
BaseBean bs = new BaseBean();
RecordSet rs = new RecordSet();
boolean flag = false;
String sumcount="";
String sql=" select count(*) as sumcount from ecology_message_type where id='"+smstypeid+"'";
rs.execute(sql);
if(rs.next()){
sumcount=Util.null2String(rs.getString("sumcount"));
}
if("0".equals(sumcount)){
return flag;
}
MessageType messageType = MessageType.newInstance(smstypeid); // 消息来源(见文档第四点补充 必填)
try {
MessageBean messageBean = Util_Message.createMessage(messageType, sendIdSet, title, context, linkPcUrl, linkMobileUrl);
messageBean.setCreater(1);// 创建人id
messageBean.setDetailTitle("");
flag = Util_Message.store(messageBean);
} catch (IOException e) {
flag = false;
e.printStackTrace();
bs.writeLog("send message error:",e);
}
return flag;
}
%>
<%!
/***
*
* @param uuid
*/
public int updateWishesInfo(String uuid,String fsr,String jsr,String zfy,String zftp){
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
int count = 0;
ModeRightInfo modeRightInfo = new ModeRightInfo();
bb.writeLog("uuid:"+uuid);
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat formatter2 = new SimpleDateFormat("HH:mm:ss");
String currentdate = formatter1.format(new Date());
String currenttime = formatter2.format(new Date());
String modedatacreater = "1";
String modedatacreatertype = "0";
String fromtable = "uf_rzznzf" ;
String formmodeid = "" ;
String sql =" select k.id from modeinfo k \n" +
" inner join workflow_bill l on formid = l.id\n" +
" where l.tablename = '"+fromtable+"' " ;
rs.execute(sql);
if(rs.next()){
formmodeid = Util.null2String(rs.getString("id"));
}
bb.writeLog("formmodeid:"+formmodeid);
Map<String, String> datas = new HashMap<String, String>();
datas.put("formmodeid", formmodeid);
datas.put("modedatacreater", modedatacreater);
datas.put("modedatacreatertype", modedatacreatertype);
datas.put("modedatacreatedate", currentdate);
datas.put("modedatacreatetime", currenttime);
datas.put("uuid", uuid);
datas.put("fsr", fsr);
datas.put("fsrid", fsr);
datas.put("jsr", jsr);
datas.put("jsrid", jsr);
datas.put("zfy", zfy);
datas.put("zftp", zftp);
String tablenvalue = "";
String tablename = "";
for (Map.Entry<String, String> entry : datas.entrySet()) {
String fieldname = Util.null2String(entry.getKey()).trim();
String fieldvalue = Util.null2String(entry.getValue()).replace("'", "''").trim();
tablename += tablename == "" ? fieldname : "," + fieldname;
tablenvalue += tablenvalue == "" ? "'" + fieldvalue + "'" : ",'" + fieldvalue + "'";
}
if (tablename != "" && tablenvalue != "") {
sql = " insert into " + fromtable + "(" + tablename + ") values (" + tablenvalue + ")";
bb.writeLog("sql:" + sql);
boolean boo = rs.executeUpdate(sql);
if (boo) {
count++;
}
bb.writeLog("count:" + count);
if (count > 0) {
String dataid = "";
sql = " select id from " + fromtable + " where uuid='" + uuid + "'";
bb.writeLog("sql:" + sql);
rs.execute(sql);
if (rs.next()) {
dataid = Util.null2String(rs.getString("id"));
}
if (!"".equals(dataid)) {
modeRightInfo.editModeDataShare(Integer.valueOf(modedatacreater), Util.getIntValue(formmodeid), Integer.parseInt(dataid));
}
}
}
return count;
}
%>