diff --git a/interface/mingfeng/getAnniversaryImage.jsp b/interface/mingfeng/getAnniversaryImage.jsp new file mode 100644 index 0000000..8a0255a --- /dev/null +++ b/interface/mingfeng/getAnniversaryImage.jsp @@ -0,0 +1,68 @@ +<%@ page import="weaver.general.*" %> +<%@page import="weaver.conn.RecordSet"%> +<%@ page import="com.alibaba.fastjson.JSONObject" %> +<%@ page import="java.util.*" %> +<%@ page import="org.apache.commons.lang3.StringUtils" %> +<%@ page import="com.api.doc.detail.util.DocDownloadCheckUtil" %> +<%@ page import="weaver.hrm.User" %> +<%@ page import="weaver.hrm.HrmUserVarify" %> +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); + + User user = HrmUserVarify.getUser (request , response) ; + Map map = null; + List> list = new ArrayList>(); + + String sql = " select id,tp,zfy,zfby from uf_rzzntp where sfqy = 0 "; + rs.executeQuery(sql); + while (rs.next()){ + String billid = Util.null2String(rs.getString("id")); + String tp = Util.null2String(rs.getString("tp")); + String zfy = Util.null2String(rs.getString("zfy")); + String zfby = Util.null2String(rs.getString("zfby")); + map = new HashMap(); + map.put("billid",billid); + map.put("tp",tp); + map.put("zfy",zfy); + map.put("zfby",zfby); + list.add(map); + } + + for(int i=0;i dataMap = list.get(i); + String tp = dataMap.get("tp"); + if(StringUtils.isNotBlank(tp)){ + String imagefileid = "" ; + sql = " select k.imagefileid \n" + + " from DocImageFile t\n" + + " inner join imagefile k on k.imagefileid = t.imagefileid\n" + + " where docid="+tp ; + rs.executeQuery(sql); + if(rs.next()){ + imagefileid = Util.null2String(rs.getString("imagefileid")); + } + + if(StringUtils.isNotBlank(imagefileid)){ + String imageurl =""; + String imagefileid_ = DocDownloadCheckUtil.checkPermission(imagefileid,user); + if(StringUtils.isNotBlank(imagefileid_)){ + imageurl = "/weaver/weaver.file.FileDownload?fileid="+imagefileid_; + } + dataMap.put("imagefileid",imagefileid); + dataMap.put("imageurl",imageurl); + } + } + } + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("data",list); + +%> +<%=jsonObject.toString() %> + + + + diff --git a/interface/mingfeng/getAnniversaryWishes2.jsp b/interface/mingfeng/getAnniversaryWishes2.jsp new file mode 100644 index 0000000..7a9cf86 --- /dev/null +++ b/interface/mingfeng/getAnniversaryWishes2.jsp @@ -0,0 +1,244 @@ +<%@ page import="weaver.general.*" %> +<%@page import="weaver.conn.RecordSet"%> +<%@ page import="com.alibaba.fastjson.JSONObject" %> +<%@ page import="java.util.*" %> +<%@ page import="org.apache.commons.lang3.StringUtils" %> +<%@ page import="java.text.SimpleDateFormat" %> +<%@ page import="weaver.formmode.setup.ModeRightInfo" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + + RecordSet rs = new RecordSet(); + String billid = "" ; + String modeid = "" ; + String formid = "" ; + String ry = request.getParameter("ry"); + String nf = request.getParameter("nf"); + String uftable = "uf_rzznzfgly"; + + String sql =" select k.id,k.formid from modeinfo k \n" + + " inner join workflow_bill l on formid = l.id\n" + + " where l.tablename = '"+uftable+"' " ; + rs.execute(sql); + if(rs.next()){ + modeid = Util.null2String(rs.getString("id")); + formid = Util.null2String(rs.getString("id")); + } + + if(StringUtils.isNotBlank(ry) && StringUtils.isNotBlank(nf)){ + + sql = " select id from "+uftable+" where ry='"+ry+"' and nf ='"+nf+"'"; + rs.executeQuery(sql); + if(rs.next()){ + billid = Util.null2String(rs.getString("id")); + } + if(StringUtils.isBlank(billid)){ + + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + String currentYear = sdf2.format(calendar.getTime()) ; + bb.writeLog("currentYear:"+currentYear); + + Map dataMap = new HashMap(); + sql = " select k.* from (" + + " select h.id,h.lastname,h.sex,h.companystartdate,h.departmentid,h.subcompanyid1,d.departmentname,s.subcompanyname,k.jobtitlename," + + " datediff(year,h.companystartdate,convert(varchar(50), getdate(), 23)) as rzzn," + + " right(companystartdate,5) startday " + + " from hrmresource h " + + " inner join HrmDepartment d on d.id = h.departmentid " + + " inner join HrmSubCompany s on s.id = h.subcompanyid1 " + + " inner join HrmJobTitles k on k.id = h.jobtitle " + + " where h.status in(0,1,2,3) " + + " and h.belongto is null " + + " and h.id = " + ry +""+ + " ) k where k.rzzn > 0 " ; + + bb.writeLog("updateAnniversaryWishes-sql:"+sql); + rs.executeQuery(sql); + while (rs.next()){ + String userid = Util.null2String(rs.getString("id")); + String lastname = Util.null2String(rs.getString("lastname")); + int rzzn = Util.getIntValue(Util.null2String(rs.getString("rzzn")),0); + String subcompanyid1 = Util.null2String(rs.getString("subcompanyid1")); + String departmentid = Util.null2String(rs.getString("departmentid")); + String zfy = getZfy(lastname,rzzn); + String companystartdate = Util.null2String(rs.getString("companystartdate")); + + + dataMap = new HashMap(); + dataMap.put("ry",userid); + dataMap.put("xm",lastname); + dataMap.put("zfy",zfy); + dataMap.put("bm",departmentid); + dataMap.put("rzrq",companystartdate); + dataMap.put("fb",subcompanyid1); + dataMap.put("nf",currentYear); + dataMap.put("rzzn",rzzn+""); + +// if(rzzn > 0){ +// String rzzzdx = convert(rzzn); +// if(StringUtils.isNotBlank(rzzzdx)){ +// String zfy ="
\n" + +// "

亲爱的李旺

\n" + +// "

 

\n" + +// "

衷心祝贺您与铭沣同行周年快乐!

\n" + +// "

感谢您将自己的青春年华和工作热情奉献给了铭沣!

\n" + +// "

感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!

\n" + +// "

今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......

\n" + +// "

但公司记得您每一份付出和努力!

\n" + +// "

感谢您的一路相伴,未来我们继续同行!

\n" + +// "

 

\n" + +// "

 

\n" + +// "

 MATFRON

\n" + +// "
" ; +// +// dataMap = new HashMap(); +// dataMap.put("ry",userid); +// dataMap.put("xm",lastname); +// dataMap.put("zfy",zfy); +// dataMap.put("bm",departmentid); +// dataMap.put("fb",subcompanyid1); +// dataMap.put("nf",currentYear); +// dataMap.put("rzzn",rzzn+""); +// } +// } + } + + if(StringUtils.isNotBlank(modeid)){ + billid = updateWishesInfo(uftable,dataMap,formid); + } + } + } + + JSONObject jsonObject = new JSONObject(); + if(StringUtils.isNotBlank(billid)){ + jsonObject.put("code",200); + }else{ + jsonObject.put("code",-100); + } + + jsonObject.put("billid",billid); + jsonObject.put("modeid",modeid); + jsonObject.put("formid",formid); + +%> +<%=jsonObject.toString() %> + + +<%! + + public String updateWishesInfo(String fromtable,Map datas,String formmodeid){ + RecordSet rs = new RecordSet(); + String dataid = "" ; + BaseBean bb = new BaseBean(); + ModeRightInfo modeRightInfo = new ModeRightInfo(); + String uuid = UUID.randomUUID().toString().replace("-",""); + 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"; + + bb.writeLog("formmodeid:"+formmodeid); + datas.put("formmodeid", formmodeid); + datas.put("modedatacreater", modedatacreater); + datas.put("modedatacreatertype", modedatacreatertype); + datas.put("modedatacreatedate", currentdate); + datas.put("modedatacreatetime", currenttime); + datas.put("uuid", uuid); + + String tablenvalue = ""; + String tablename = ""; + for (Map.Entry 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 != "") { + int count = 0; + String 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) { + 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 dataid; + } + + public static String convert(int number) { + if (number <= 0) { + return ""; + } + //数字对应的汉字 + String[] num = {"一", "二", "三", "四", "五", "六", "七", "八", "九"}; + //单位 + String[] unit = {"", "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千", "万亿"}; + //将输入数字转换为字符串 + String result = String.valueOf(number); + //将该字符串分割为数组存放 + char[] ch = result.toCharArray(); + //结果 字符串 + String str = ""; + int length = ch.length; + for (int i = 0; i < length; i++) { + int c = (int) ch[i] - 48; + if (c != 0) { + str += num[c - 1] + unit[length - i - 1]; + } + } + if (number < 20 && number > 9) { + str = str.substring(1); + } +// System.out.println(str); + return str ; + } + + + public String getZfy(String lastname,int rzzn){ + String rzzzdx = "" ; + if(rzzn > 0){ + rzzzdx = convert(rzzn); + } + String zfy ="
\n" + + "

亲爱的"+lastname+"

\n" + + "

 

\n" + + "

衷心祝贺您与铭沣同行"+rzzzdx+"周年快乐!

\n" + + "

感谢您将自己的青春年华和工作热情奉献给了铭沣!

\n" + + "

感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!

\n" + + "

今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......

\n" + + "

但公司记得您每一份付出和努力!

\n" + + "

感谢您的一路相伴,未来我们继续同行!

\n" + + "

 

\n" + + "

 

\n" + + "

 MATFRON

\n" + + "
"; + return zfy; + } + + + +%> + + + + diff --git a/interface/mingfeng/getCompanyAnniversary.jsp b/interface/mingfeng/getCompanyAnniversary.jsp index 578d243..44b4481 100644 --- a/interface/mingfeng/getCompanyAnniversary.jsp +++ b/interface/mingfeng/getCompanyAnniversary.jsp @@ -4,17 +4,16 @@ <%@ page import="java.text.SimpleDateFormat" %> <%@ page import="java.util.*" %> <%@ page import="org.apache.commons.lang3.StringUtils" %> +<%@ page import="weaver.formmode.setup.ModeRightInfo" %> <%@ page language="java" contentType="text/html; charset=UTF-8" %> <% List> dataList = new ArrayList>(); - Map dataMap = null; + Map data_Map = null; RecordSet rs = new RecordSet(); BaseBean bb = new BaseBean(); SimpleDateFormat sdf = new SimpleDateFormat("MM-dd" ) ; -// Calendar calendar = Calendar.getInstance() ; -// String currentDay = sdf.format(calendar.getTime()) ; -// bb.writeLog("currentDay:"+currentDay); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; for(int i=0;i<30;i++) { @@ -22,6 +21,8 @@ calendar.add(Calendar.DAY_OF_YEAR, 0-i); String currentDay = sdf.format(calendar.getTime()) ; bb.writeLog("currentDay:"+currentDay); + String currentYear = sdf2.format(calendar.getTime()) ; + bb.writeLog("currentYear:"+currentYear); String sql =" select k.* from (select h.id,h.lastname,h.sex,h.departmentid,d.departmentname,s.subcompanyname,k.jobtitlename," + " datediff(year,h.companystartdate,convert(varchar(50), getdate(), 23)) as zn" + @@ -31,13 +32,13 @@ " inner join HrmJobTitles k on k.id = h.jobtitle\n" + " where h.companystartdate like '%"+currentDay+"'\n" + " and h.status in(0,1,2,3)" + - " and h.belongto is null " + + " and h.belongto is null and h.companystartdate is not null " + " ) k where k.zn > 0 " ; bb.writeLog("sql:"+sql); rs.executeQuery(sql); while (rs.next()){ - String id = Util.null2String(rs.getString("id")); + String userid = Util.null2String(rs.getString("id")); String lastname = Util.null2String(rs.getString("lastname")); String sex = Util.null2String(rs.getString("sex")); String departmentname = Util.null2String(rs.getString("departmentname")); @@ -47,23 +48,60 @@ String jobtitlename = Util.null2String(rs.getString("jobtitlename")); String deptnamenew = "" ; - dataMap = new HashMap(); - dataMap.put("userid",id); - dataMap.put("sex",sex); - dataMap.put("jobtitlename",jobtitlename); - dataMap.put("lastname",lastname); - dataMap.put("departmentname",departmentname); - dataMap.put("subcompanyname",subcompanyname); + data_Map = new HashMap(); + data_Map.put("userid",userid); + data_Map.put("sex",sex); + data_Map.put("jobtitlename",jobtitlename); + data_Map.put("lastname",lastname); + data_Map.put("departmentname",departmentname); + data_Map.put("subcompanyname",subcompanyname); if(StringUtils.isNotBlank(departmentid)){ deptnamenew = getTopDepartment(departmentid); } - dataMap.put("deptnamenew",deptnamenew); - dataMap.put("zn",zn); - dataList.add(dataMap); + data_Map.put("deptnamenew",deptnamenew); + data_Map.put("zn",zn); + data_Map.put("nf",currentYear); + dataList.add(data_Map); } + } + + String billid = "" ; + String modeid = "" ; + String formid = "" ; + String uftable = "uf_rzznzfgly"; + String sql =" select k.id,k.formid from modeinfo k \n" + + " inner join workflow_bill l on formid = l.id\n" + + " where l.tablename = '"+uftable+"' " ; + rs.execute(sql); + if(rs.next()){ + modeid = Util.null2String(rs.getString("id")); + formid = Util.null2String(rs.getString("formid")); } + for(int i=0;i dMap = dataList.get(i); + String nf = dMap.get("nf"); + String ry = dMap.get("userid"); + + + if(StringUtils.isNotBlank(ry) && StringUtils.isNotBlank(nf)){ + + sql = " select id from "+uftable+" where ry='"+ry+"' and nf ='"+nf+"'"; + rs.executeQuery(sql); + if(rs.next()){ + billid = Util.null2String(rs.getString("id")); + } + if(StringUtils.isBlank(billid)){ + billid = updateAnniversaryWishes(ry,modeid); + } + } + + dMap.put("billid",billid); + dMap.put("modeid",modeid); + dMap.put("formid",formid); + } JSONObject jsonObject = new JSONObject(); jsonObject.put("data",dataList); @@ -106,6 +144,208 @@ + public String updateAnniversaryWishes(String user_id,String modeid){ + + String billid = "" ; + BaseBean log = new BaseBean(); + log.writeLog("updateAnniversaryWishes! "); + + String uftable = "uf_rzznzfgly"; + RecordSet rs = new RecordSet(); + + BaseBean bb = new BaseBean(); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + + try{ + Map dataMap = new HashMap(); + + String currentYear = sdf2.format(new Date()) ; + bb.writeLog("currentYear:"+currentYear); + + String sql =" select k.* from (" + + " select h.id,h.lastname,h.sex,h.companystartdate,h.departmentid,h.subcompanyid1," + + " datediff(year,h.companystartdate,convert(varchar(50), getdate(), 23)) as rzzn," + + " right(companystartdate,5) startday " + + " from hrmresource h " + + " where h.id = "+user_id+" " + + " and h.status in(0,1,2,3) " + + " and h.belongto is null " + + " and h.companystartdate is not null " + + " ) k where k.rzzn > 0 " + + " order by k.startday desc " ; + + bb.writeLog("updateAnniversaryWishes-sql:"+sql); + + rs.executeQuery(sql); + if (rs.next()){ + String userid = Util.null2String(rs.getString("id")); + String lastname = Util.null2String(rs.getString("lastname")); + int rzzn = Util.getIntValue(Util.null2String(rs.getString("rzzn")),0); + String subcompanyid1 = Util.null2String(rs.getString("subcompanyid1")); + String departmentid = Util.null2String(rs.getString("departmentid")); + String companystartdate = Util.null2String(rs.getString("companystartdate")); + String zfy =getZfy(lastname,rzzn); + + dataMap = new HashMap(); + dataMap.put("ry",userid); + dataMap.put("xm",lastname); + dataMap.put("zfy",zfy); + dataMap.put("bm",departmentid); + dataMap.put("rzrq",companystartdate); + dataMap.put("fb",subcompanyid1); + dataMap.put("nf",currentYear); + dataMap.put("rzzn",rzzn+""); + +// if(rzzn > 0){ +// String rzzzdx = convert(rzzn); +// if(StringUtils.isNotBlank(rzzzdx)){ +// +//// String zfy ="
" + +//// "

亲爱的"+lastname+"

\n" + +//// "

 

\n" + +//// "

衷心祝贺您与铭沣同行"+rzzzdx+"周年快乐!

\n" + +//// "

感谢您将自己的青春年华和工作热情奉献给了铭沣!

\n" + +//// "

感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!

\n" + +//// "

今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......

\n" + +//// "

但公司记得您每一份付出和努力!

\n" + +//// "

感谢您的一路相伴,未来我们继续同行!

\n" + +//// "

 

\n" + +//// "

 

\n" + +//// "

 MATFRON

" + +//// "
\n"; +// +// +// +// } +// } + } + + if(!dataMap.isEmpty()){ + String ry = dataMap.get("ry"); + String nf = dataMap.get("nf"); + String ufid = "" ; + sql = " select id from "+uftable+" where ry='"+ry+"' and nf = '"+nf+"'"; + rs.executeQuery(sql); + if(rs.next()){ + ufid = Util.null2String(rs.getString("id")); + } + if(StringUtils.isBlank(ufid)){ + billid = updateWishesInfo(uftable,dataMap,modeid); + } + } + }catch (Exception e){ + + } + + return billid; + } + + + public String updateWishesInfo(String fromtable,Map datas,String formmodeid){ + RecordSet rs = new RecordSet(); + String dataid = "" ; + BaseBean bb = new BaseBean(); + ModeRightInfo modeRightInfo = new ModeRightInfo(); + String uuid = UUID.randomUUID().toString().replace("-",""); + 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"; + + bb.writeLog("formmodeid:"+formmodeid); + datas.put("formmodeid", formmodeid); + datas.put("modedatacreater", modedatacreater); + datas.put("modedatacreatertype", modedatacreatertype); + datas.put("modedatacreatedate", currentdate); + datas.put("modedatacreatetime", currenttime); + datas.put("uuid", uuid); + + String tablenvalue = ""; + String tablename = ""; + for (Map.Entry 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 != "") { + int count = 0; + String 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) { + 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 dataid; + } + + public static String convert(int number) { + if (number <= 0) { + return ""; + } + //数字对应的汉字 + String[] num = {"一", "二", "三", "四", "五", "六", "七", "八", "九"}; + //单位 + String[] unit = {"", "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千", "万亿"}; + //将输入数字转换为字符串 + String result = String.valueOf(number); + //将该字符串分割为数组存放 + char[] ch = result.toCharArray(); + //结果 字符串 + String str = ""; + int length = ch.length; + for (int i = 0; i < length; i++) { + int c = (int) ch[i] - 48; + if (c != 0) { + str += num[c - 1] + unit[length - i - 1]; + } + } + if (number < 20 && number > 9) { + str = str.substring(1); + } +// System.out.println(str); + return str ; + } + + + public String getZfy(String lastname,int rzzn){ + String rzzzdx = "" ; + if(rzzn > 0){ + rzzzdx = convert(rzzn); + } + String zfy ="
\n" + + "

亲爱的"+lastname+"

\n" + + "

 

\n" + + "

衷心祝贺您与铭沣同行"+rzzzdx+"周年快乐!

\n" + + "

感谢您将自己的青春年华和工作热情奉献给了铭沣!

\n" + + "

感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!

\n" + + "

今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......

\n" + + "

但公司记得您每一份付出和努力!

\n" + + "

感谢您的一路相伴,未来我们继续同行!

\n" + + "

 

\n" + + "

 

\n" + + "

 MATFRON

\n" + + "
"; + return zfy; + } + %> diff --git a/interface/mingfeng/getUserBirthdayAjax.jsp b/interface/mingfeng/getUserBirthdayAjax.jsp index df77375..9988a6a 100644 --- a/interface/mingfeng/getUserBirthdayAjax.jsp +++ b/interface/mingfeng/getUserBirthdayAjax.jsp @@ -1,17 +1,22 @@ <%@ page import="weaver.general.*" %> -<%@page import="weaver.conn.RecordSet"%> +<%@ page import="weaver.conn.RecordSet"%> <%@ page import="com.alibaba.fastjson.JSONObject" %> <%@ page import="java.text.SimpleDateFormat" %> <%@ page import="java.util.*" %> +<%@ page import="org.apache.commons.lang3.StringUtils" %> +<%@ page import="weaver.formmode.setup.ModeRightInfo" %> <%@ page language="java" contentType="text/html; charset=UTF-8" %> - <% List> dataList = new ArrayList>(); Map dataMap = null; RecordSet rs = new RecordSet(); BaseBean bb = new BaseBean(); - String timestrformart = "MM-dd" ; - SimpleDateFormat sdf = new SimpleDateFormat(timestrformart) ; + + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + String currentYear = sdf2.format(new Date()) ; + bb.writeLog("currentYear:"+currentYear); + + SimpleDateFormat sdf = new SimpleDateFormat("MM-dd") ; Calendar calendar = Calendar.getInstance() ; String currentDay = sdf.format(calendar.getTime()) ; bb.writeLog("currentDay:"+currentDay); @@ -37,14 +42,211 @@ dataMap.put("lastname",lastname); dataMap.put("departmentname",departmentname); dataMap.put("subcompanyname",subcompanyname); + dataMap.put("nf",currentYear); dataList.add(dataMap); } + String billid = "" ; + String modeid = "" ; + String formid = "" ; + String uftable = "uf_srzf"; + sql = " select k.id,k.formid from modeinfo k \n" + + " inner join workflow_bill l on formid = l.id\n" + + " where l.tablename = '"+uftable+"' " ; + rs.execute(sql); + if(rs.next()){ + modeid = Util.null2String(rs.getString("id")); + formid = Util.null2String(rs.getString("formid")); + } + + + for(int i=0;i dMap = dataList.get(i); + String nf = dMap.get("nf"); + String ry = dMap.get("userid"); + + if(StringUtils.isNotBlank(ry) && StringUtils.isNotBlank(nf)){ + sql = " select id from "+uftable+" where ry='"+ry+"' and nf ='"+nf+"'"; + rs.executeQuery(sql); + if(rs.next()){ + billid = Util.null2String(rs.getString("id")); + } + if(StringUtils.isBlank(billid)){ + billid = updateUserBrithdayWishes(ry); + } + } + + dMap.put("billid",billid); + dMap.put("modeid",modeid); + dMap.put("formid",formid); + } + JSONObject jsonObject = new JSONObject(); jsonObject.put("data",dataList); %> -<%=jsonObject.toString() %> +<%=jsonObject.toJSONString() %> + + +<%! + + public String updateUserBrithdayWishes(String user_id){ + + String billid = ""; + BaseBean log = new BaseBean(); + log.writeLog("updateUserBrithdayWishes! "); + + String uftable = "uf_srzf"; + RecordSet rs = new RecordSet(); + + + BaseBean bb = new BaseBean(); + SimpleDateFormat sdf = new SimpleDateFormat("MM-dd" ) ; + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + + try{ + Map dataMap = new HashMap(); + + String currentYear = sdf2.format(new Date()) ; + bb.writeLog("currentYear:"+currentYear); + + String sql =" select h.id,h.lastname,h.sex,h.birthday,h.departmentid,h.subcompanyid1" + + " from hrmresource h " + + " where id = "+user_id+" " + + " and h.status in(0,1,2,3) " + + " and h.belongto is null " + + " and h.birthday is not null " + + " order by id " ; + + bb.writeLog("updateAnniversaryWishes-sql:"+sql); + rs.executeQuery(sql); + if (rs.next()){ + String userid = Util.null2String(rs.getString("id")); + String lastname = Util.null2String(rs.getString("lastname")); + String subcompanyid1 = Util.null2String(rs.getString("subcompanyid1")); + String departmentid = Util.null2String(rs.getString("departmentid")); + String birthday = Util.null2String(rs.getString("birthday")); + + String zfy = getZfy(lastname); + + dataMap = new HashMap(); + dataMap.put("ry",userid); + dataMap.put("rymc",lastname); + dataMap.put("ryid",userid); + dataMap.put("zfy",zfy); + dataMap.put("bm",departmentid); + dataMap.put("sr",birthday); + dataMap.put("fb",subcompanyid1); + dataMap.put("nf",currentYear); + + } + + if(!dataMap.isEmpty()){ + String ry = dataMap.get("ry"); + String nf = dataMap.get("nf"); + String ufid = "" ; + sql = " select id from "+uftable+" where ry='"+ry+"' and nf = '"+nf+"'"; + rs.executeQuery(sql); + if(rs.next()){ + ufid = Util.null2String(rs.getString("id")); + } + if(StringUtils.isBlank(ufid)){ + billid = updateBrithdayInfo(uftable,dataMap); + } + } + }catch (Exception e){ + + } + return billid; + } + + public String updateBrithdayInfo(String fromtable,Map datas){ + RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); + + String dataid = ""; + + ModeRightInfo modeRightInfo = new ModeRightInfo(); + String uuid = UUID.randomUUID().toString().replace("-",""); + 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 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); + datas.put("formmodeid", formmodeid); + datas.put("modedatacreater", modedatacreater); + datas.put("modedatacreatertype", modedatacreatertype); + datas.put("modedatacreatedate", currentdate); + datas.put("modedatacreatetime", currenttime); + datas.put("uuid", uuid); + + String tablenvalue = ""; + String tablename = ""; + for (Map.Entry 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 != "") { + int count = 0; + 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) { + + 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 dataid; + } + + + public String getZfy(String lastname){ + + String zfy ="
\n" + + "

亲爱的"+lastname+"

\n" + + "

 

\n" + + "

时光是一把神奇的钥匙,让每个脚印都坚实而有力量;

\n" + + "

岁月是看不见的年轮,让每次付出都收获希望与果实;

\n" + + "

感谢您的全力奔跑,感恩您的笃定前行;

\n" + + "

今天是您的生日!

\n" + + "

在这个没有流星也可以许愿的日子里,祝您生日快乐!

\n" + + "

愿您心之所向,光芒万丈,所盼皆所成,所思终所拥!

\n" + + "

 

\n" + + "

 

\n" + + "

 MATFRON

\n" + + "
"; + return zfy; + } +%> \ No newline at end of file diff --git a/interface/mingfeng/getUserBirthdayImage.jsp b/interface/mingfeng/getUserBirthdayImage.jsp new file mode 100644 index 0000000..134b5f5 --- /dev/null +++ b/interface/mingfeng/getUserBirthdayImage.jsp @@ -0,0 +1,64 @@ +<%@ page import="weaver.general.*" %> +<%@page import="weaver.conn.RecordSet"%> +<%@ page import="com.alibaba.fastjson.JSONObject" %> +<%@ page import="java.util.*" %> +<%@ page import="org.apache.commons.lang3.StringUtils" %> +<%@ page import="com.api.doc.detail.util.DocDownloadCheckUtil" %> +<%@ page import="weaver.hrm.User" %> +<%@ page import="weaver.hrm.HrmUserVarify" %> +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); + + User user = HrmUserVarify.getUser (request , response) ; + Map map = null; + List> list = new ArrayList>(); + + String sql = " select id,tp from uf_srzftp where sfqy = 0 "; + rs.executeQuery(sql); + while (rs.next()){ + String billid = Util.null2String(rs.getString("id")); + String tp = Util.null2String(rs.getString("tp")); + map = new HashMap(); + map.put("billid",billid); + map.put("tp",tp); + list.add(map); + } + + for(int i=0;i dataMap = list.get(i); + String tp = dataMap.get("tp"); + if(StringUtils.isNotBlank(tp)){ + String imagefileid = "" ; + sql = " select k.imagefileid \n" + + " from DocImageFile t\n" + + " inner join imagefile k on k.imagefileid = t.imagefileid\n" + + " where docid="+tp ; + rs.executeQuery(sql); + if(rs.next()){ + imagefileid = Util.null2String(rs.getString("imagefileid")); + } + + if(StringUtils.isNotBlank(imagefileid)){ + String imageurl =""; + String imagefileid_ = DocDownloadCheckUtil.checkPermission(imagefileid,user); + if(StringUtils.isNotBlank(imagefileid_)){ + imageurl = "/weaver/weaver.file.FileDownload?fileid="+imagefileid_; + } + dataMap.put("imagefileid",imagefileid); + dataMap.put("imageurl",imageurl); + } + } + } + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("data",list); + +%> +<%=jsonObject.toString() %> + + + + diff --git a/interface/mingfeng/sendAnniversaryWishes2.jsp b/interface/mingfeng/sendAnniversaryWishes2.jsp new file mode 100644 index 0000000..1364e71 --- /dev/null +++ b/interface/mingfeng/sendAnniversaryWishes2.jsp @@ -0,0 +1,303 @@ +<%@ 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" %> +<%@ page import="sun.misc.BASE64Decoder" %> +<%@ page import="com.api.doc.detail.util.DocDownloadCheckUtil" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + RecordSet rs = new RecordSet(); + JSONObject jsonObject = new JSONObject(); + Map apidatas = new HashMap(); + User user = HrmUserVarify.getUser (request , response) ; + + String billid = request.getParameter("billid"); + String modeid = request.getParameter("modeid"); + String formid = request.getParameter("formid"); + String userid = request.getParameter("userid") ; + String anniversary = request.getParameter("rzzn") ; + + bb.writeLog("userid3333:"+userid); + + String zfy = request.getParameter("zfy") ; + String imagefileid = request.getParameter("imagefileid") ; + String imagebillid = request.getParameter("imagebillid") ; + String imageurl = "" ; + if(StringUtils.isNotBlank(imagefileid)){ + String imagefileid_ = DocDownloadCheckUtil.checkPermission(imagefileid,null); + if(StringUtils.isNotBlank(imagefileid_)){ + imageurl = "/weaver/weaver.file.FileDownload?fileid="+imagefileid_; + } + }else { + String tp = ""; + String imageid = ""; + String sql = " select tp from uf_rzzntp where id = " + imagebillid; + rs.executeQuery(sql); + if (rs.next()) { + tp = Util.null2String(rs.getString("tp")); + } + + if (StringUtils.isNotBlank(tp)) { + sql = " select k.imagefileid \n" + + " from DocImageFile t \n" + + " inner join imagefile k on k.imagefileid = t.imagefileid \n" + + " where docid= " + tp; + rs.executeQuery(sql); + if (rs.next()) { + imageid = Util.null2String(rs.getString("imagefileid")); + } + + if (StringUtils.isNotBlank(imageid)) { + String imagefileid_ = DocDownloadCheckUtil.checkPermission(imageid, null); + if (StringUtils.isNotBlank(imagefileid_)) { + imageurl = "/weaver/weaver.file.FileDownload?fileid=" + imagefileid_; + } + } + } + } + + int smstypeid = Util.getIntValue(request.getParameter("smstypeid"),563); + + String from = "reply"; + String src = "submit"; + String iscreate = "1" ; + String isFormMode = "1"; + String username = "" ; + 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); + + BASE64Decoder decoder = new BASE64Decoder(); + if(StringUtils.isNotBlank(zfy)){ + zfy = new String(decoder.decodeBuffer(zfy),"UTF-8"); + } + + String contentHtml ="

\"\"

\n" + + "

 

\n" + + "

"+zfy+"

"; + + BASE64Encoder encoder = new BASE64Encoder(); + String replycontent = encoder.encode(contentHtml.getBytes("UTF-8")); + + Map paramMap = new HashMap(); + paramMap.put("reqModeId",modeid); + paramMap.put("reqBillid",billid); + paramMap.put("reqFormid",formid); + paramMap.put("isFormMode",isFormMode); + paramMap.put("from",from); + paramMap.put("src",src); + paramMap.put("iscreate",iscreate); + paramMap.put("replycontent",replycontent); + paramMap.put("isEditOpt","0"); + + Map dataMap = this.getService(user).replySubmit(paramMap,user); + if(dataMap.isEmpty()){ + apidatas.put("status", "1"); + + String linkUrl = "/spa/cube/index.html#/main/cube/card?type=0&modeId="+modeid+"&formId="+formid+"&billid="+billid; + String linkMobileUrl = "/spa/cube/index.html#/main/cube/card?type=0&modeId="+modeid+"&formId="+formid+"&billid="+billid; + bb.writeLog("linkUrl:"+linkUrl); + String title = " "; + String content = zfy; + Set userSet = new HashSet(); + userSet.add(userid); + sendMessage(smstypeid,userSet,title,content,linkUrl,linkMobileUrl); + + jsonObject.put("code","200"); + jsonObject.put("data",apidatas); + }else{ + apidatas.put("status", "0"); + jsonObject.put("code","100"); + } + }else{ + jsonObject.put("code","-100"); + } + + + +// 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 userSet = new HashSet(); + 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 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 datas = new HashMap(); + 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 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; + } + + +%> + + + diff --git a/interface/mingfeng/sendBirthdayWishes.jsp b/interface/mingfeng/sendBirthdayWishes.jsp new file mode 100644 index 0000000..38e7357 --- /dev/null +++ b/interface/mingfeng/sendBirthdayWishes.jsp @@ -0,0 +1,187 @@ +<%@ 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="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" %> +<%@ page import="sun.misc.BASE64Decoder" %> +<%@ page import="com.api.doc.detail.util.DocDownloadCheckUtil" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + RecordSet rs = new RecordSet(); + JSONObject jsonObject = new JSONObject(); + Map apidatas = new HashMap(); + User user = HrmUserVarify.getUser (request , response) ; + + String billid = request.getParameter("billid"); + String modeid = request.getParameter("modeid"); + String formid = request.getParameter("formid"); + String userid = request.getParameter("userid") ; + + bb.writeLog("userid666:"+userid); + + String zfy = request.getParameter("zfy") ; + String imagefileid = request.getParameter("imagefileid") ; + String imagebillid = request.getParameter("imagebillid") ; + String imageurl = "" ; + if(StringUtils.isNotBlank(imagefileid)){ + String imagefileid_ = DocDownloadCheckUtil.checkPermission(imagefileid,null); + if(StringUtils.isNotBlank(imagefileid_)){ + imageurl = "/weaver/weaver.file.FileDownload?fileid="+imagefileid_; + } + }else { + String tp = ""; + String imageid = ""; + String sql = " select tp from uf_srzftp where id = " + imagebillid; + rs.executeQuery(sql); + if (rs.next()) { + tp = Util.null2String(rs.getString("tp")); + } + bb.writeLog("tp:"+tp); + if (StringUtils.isNotBlank(tp)) { + sql = " select k.imagefileid \n" + + " from DocImageFile t \n" + + " inner join imagefile k on k.imagefileid = t.imagefileid \n" + + " where docid= " + tp; + rs.executeQuery(sql); + if (rs.next()) { + imageid = Util.null2String(rs.getString("imagefileid")); + } + bb.writeLog("imageid:"+imageid); + if (StringUtils.isNotBlank(imageid)) { + String imagefileid_ = DocDownloadCheckUtil.checkPermission(imageid, null); + if (StringUtils.isNotBlank(imagefileid_)) { + imageurl = "/weaver/weaver.file.FileDownload?fileid=" + imagefileid_; + } + } + } + } + + int smstypeid = Util.getIntValue(request.getParameter("smstypeid"),563); + + String from = "reply"; + String src = "submit"; + String iscreate = "1" ; + String isFormMode = "1"; + String username = "" ; + if(StringUtils.isNotEmpty(userid)){ + username = ResourceComInfo.getLastname(userid); + } + + if(StringUtils.isNotBlank(username)){ + + BASE64Decoder decoder = new BASE64Decoder(); + if(StringUtils.isNotBlank(zfy)){ + zfy = new String(decoder.decodeBuffer(zfy),"UTF-8"); + } + + String contentHtml ="

\"\"

\n" + + "

 

\n" + + "

"+zfy+"

"; + + BASE64Encoder encoder = new BASE64Encoder(); + String replycontent = encoder.encode(contentHtml.getBytes("UTF-8")); + + Map paramMap = new HashMap(); + + paramMap.put("reqModeId",modeid); + paramMap.put("reqBillid",billid); + paramMap.put("reqFormid",formid); + paramMap.put("isFormMode",isFormMode); + paramMap.put("from",from); + paramMap.put("src",src); + paramMap.put("iscreate",iscreate); + paramMap.put("replycontent",replycontent); + paramMap.put("isEditOpt","0"); + + Map dataMap = this.getService(user).replySubmit(paramMap,user); + if(dataMap.isEmpty()){ + apidatas.put("status", "1"); + + String linkUrl = "/spa/cube/index.html#/main/cube/card?type=0&modeId="+modeid+"&formId="+formid+"&billid="+billid; + String linkMobileUrl = "/spa/cube/index.html#/main/cube/card?type=0&modeId="+modeid+"&formId="+formid+"&billid="+billid; + bb.writeLog("linkUrl:"+linkUrl); + String title = " "; + String content = zfy; + Set userSet = new HashSet(); + userSet.add(userid); + sendMessage(smstypeid,userSet,title,content,linkUrl,linkMobileUrl); + + jsonObject.put("code","200"); + jsonObject.put("data",apidatas); + }else{ + apidatas.put("status", "0"); + jsonObject.put("code","100"); + } + }else{ + jsonObject.put("code","-100"); + } + + jsonObject.put("result",true); +%> +<%=jsonObject.toJSONString() %> + +<%! + + private ModeCardService getService(User user) { + return (ModeCardService) ServiceUtil.getService(ModCardServiceImpl.class, user); + } + + /*** + * + * @param smstypeid + * @param sendIdSet + * @param title + * @param context + * @param linkPcUrl + * @param linkMobileUrl + * @return + */ + public boolean sendMessage(int smstypeid, Set 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; + } + + +%> + + + + diff --git a/interface/mingfeng/testjob1.jsp b/interface/mingfeng/testjob1.jsp new file mode 100644 index 0000000..0db3c24 --- /dev/null +++ b/interface/mingfeng/testjob1.jsp @@ -0,0 +1,284 @@ +<%@ page import="weaver.general.*" %> +<%@page import="weaver.conn.RecordSet"%> +<%@ page import="com.alibaba.fastjson.JSONObject" %> +<%@ page import="java.util.*" %> +<%@ page import="java.text.SimpleDateFormat" %> +<%@ page import="weaver.formmode.setup.ModeRightInfo" %> +<%@ page import="org.apache.commons.lang3.StringUtils" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + JSONObject jsonObject = new JSONObject(); + + updateAnniversaryWishes(); + + jsonObject.put("result",true); +%> +<%=jsonObject.toJSONString() %> + +<%! + + public void updateAnniversaryWishes(){ + + BaseBean log = new BaseBean(); + log.writeLog("updateAnniversaryWishes! "); + + String uftable = "uf_rzznzfgly"; + RecordSet rs = new RecordSet(); + int days = 60 ; + + List> dataList = new ArrayList>(); + Map dataMap = null; + + BaseBean bb = new BaseBean(); + SimpleDateFormat sdf = new SimpleDateFormat("MM-dd" ) ; + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + + try{ + + for(int i=0;i 0 " + + " order by k.startday desc " ; + + bb.writeLog("updateAnniversaryWishes-sql:"+sql); + + rs.executeQuery(sql); + while (rs.next()){ + String userid = Util.null2String(rs.getString("id")); + String lastname = Util.null2String(rs.getString("lastname")); + int rzzn = Util.getIntValue(Util.null2String(rs.getString("rzzn")),0); + String subcompanyname = Util.null2String(rs.getString("subcompanyname")); + String subcompanyid1 = Util.null2String(rs.getString("subcompanyid1")); + String departmentid = Util.null2String(rs.getString("departmentid")); + String companystartdate = Util.null2String(rs.getString("companystartdate")); + + String zfy = getZfy(lastname,rzzn); + dataMap = new HashMap(); + dataMap.put("ry",userid); + dataMap.put("xm",lastname); + dataMap.put("zfy",zfy); + dataMap.put("bm",departmentid); + dataMap.put("rzrq",companystartdate); + dataMap.put("fb",subcompanyid1); + dataMap.put("nf",currentYear); + dataMap.put("rzzn",rzzn+""); + dataList.add(dataMap); + + +// if(rzzn > 0){ +// String rzzzdx = convert(rzzn); +// if(StringUtils.isNotBlank(rzzzdx)){ +//// String zfy ="
\n" +
+////                                    "	亲爱的"+lastname+"\n" +
+////                                    "	衷心祝贺您与"+subcompanyname+"同行"+rzzzdx+"周年快乐!同时也感谢您将自己的青春年华和工作热情奉献给了"+subcompanyname+"\n" +
+////                                    "	感谢您辛勤的付出\n" +
+////                                    "	感谢您不懈的跟随与守候!\n" +
+////                                    "	期待我们一起度过下一个周年\n" +
+////                                    "	今天的您是否在工作岗位上忙碌而忽略了这个重要的日子但公司记得您的每一分付出和努力。\n" +
+////                                    "	感谢有您, 一路相伴!\n" +
+////                                    "	未来, 我们继续同行!
" ; +// +//// String zfy ="
" + +//// "

亲爱的"+lastname+"

\n" + +//// "

 

\n" + +//// "

衷心祝贺您与铭沣同行"+rzzzdx+"周年快乐!

\n" + +//// "

感谢您将自己的青春年华和工作热情奉献给了铭沣!

\n" + +//// "

感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!

\n" + +//// "

今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......

\n" + +//// "

但公司记得您每一份付出和努力!

\n" + +//// "

感谢您的一路相伴,未来我们继续同行!

\n" + +//// "

 

\n" + +//// "

 

\n" + +//// "

 MATFRON

" + +//// "
\n"; +// +// +// dataMap = new HashMap(); +// dataMap.put("ry",userid); +// dataMap.put("xm",lastname); +// dataMap.put("zfy",zfy); +// dataMap.put("bm",departmentid); +// dataMap.put("rzrq",companystartdate); +// dataMap.put("fb",subcompanyid1); +// dataMap.put("nf",currentYear); +// dataMap.put("rzzn",rzzn+""); +// dataList.add(dataMap); +// } +// } + } + } + + for(int i=0;i dMap = dataList.get(i); + String ry = dMap.get("ry"); + String nf = dMap.get("nf"); + String ufid = "" ; + String sql = " select id from "+uftable+" where ry='"+ry+"' and nf = '"+nf+"'"; + rs.executeQuery(sql); + if(rs.next()){ + ufid = Util.null2String(rs.getString("id")); + } + if(StringUtils.isBlank(ufid)){ + updateWishesInfo(uftable,dMap); + }else{ + String zfy = dMap.get("zfy"); + String rzrq = dMap.get("rzrq"); + sql = " update "+uftable+" set zfy='"+zfy+"',rzrq='"+rzrq+"',rzyr='"+"' where id = "+ ufid ; + boolean isTrue = rs.executeUpdate(sql); + bb.writeLog("isTrue:"+isTrue); + } + } + +// select right(companystartdate,5) from hrmresource where companystartdate is not null +// and right(companystartdate,5) >'12-01' and right(companystartdate,5) <'12-30' + + }catch (Exception e){ + + } + } + + public int updateWishesInfo(String fromtable,Map datas){ + RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); + int count = 0; + ModeRightInfo modeRightInfo = new ModeRightInfo(); + String uuid = UUID.randomUUID().toString().replace("-",""); + 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 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); + datas.put("formmodeid", formmodeid); + datas.put("modedatacreater", modedatacreater); + datas.put("modedatacreatertype", modedatacreatertype); + datas.put("modedatacreatedate", currentdate); + datas.put("modedatacreatetime", currenttime); + datas.put("uuid", uuid); + + String tablenvalue = ""; + String tablename = ""; + for (Map.Entry 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; + } + + + + public static String convert(int number) { + if (number <= 0) { + return ""; + } + //数字对应的汉字 + String[] num = {"一", "二", "三", "四", "五", "六", "七", "八", "九"}; + //单位 + String[] unit = {"", "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千", "万亿"}; + //将输入数字转换为字符串 + String result = String.valueOf(number); + //将该字符串分割为数组存放 + char[] ch = result.toCharArray(); + //结果 字符串 + String str = ""; + int length = ch.length; + for (int i = 0; i < length; i++) { + int c = (int) ch[i] - 48; + if (c != 0) { + str += num[c - 1] + unit[length - i - 1]; + } + } + if (number < 20 && number > 9) { + str = str.substring(1); + } +// System.out.println(str); + return str ; + } + + + public String getZfy(String lastname,int rzzn){ + String rzzzdx = "" ; + if(rzzn > 0){ + rzzzdx = convert(rzzn); + } + String zfy ="
\n" + + "

亲爱的"+lastname+"

\n" + + "

 

\n" + + "

衷心祝贺您与铭沣同行"+rzzzdx+"周年快乐!

\n" + + "

感谢您将自己的青春年华和工作热情奉献给了铭沣!

\n" + + "

感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!

\n" + + "

今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......

\n" + + "

但公司记得您每一份付出和努力!

\n" + + "

感谢您的一路相伴,未来我们继续同行!

\n" + + "

 

\n" + + "

 

\n" + + "

 MATFRON

\n" + + "
"; + return zfy; + } + +%> + + + diff --git a/interface/mingfeng/testjob2.jsp b/interface/mingfeng/testjob2.jsp new file mode 100644 index 0000000..bb98a68 --- /dev/null +++ b/interface/mingfeng/testjob2.jsp @@ -0,0 +1,193 @@ +<%@ page import="weaver.general.*" %> +<%@page import="weaver.conn.RecordSet"%> +<%@ page import="com.alibaba.fastjson.JSONObject" %> +<%@ page import="java.util.*" %> +<%@ page import="java.text.SimpleDateFormat" %> +<%@ page import="weaver.formmode.setup.ModeRightInfo" %> +<%@ page import="org.apache.commons.lang3.StringUtils" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + out.println("start"); + JSONObject jsonObject = new JSONObject(); + + updateUserBrithdayWishes(); + out.println("end"); + jsonObject.put("result",true); +%> +<%=jsonObject.toJSONString() %> + +<%! + + public void updateUserBrithdayWishes(){ + + BaseBean log = new BaseBean(); + log.writeLog("updateUserBrithdayWishes! "); + + String uftable = "uf_srzf"; + RecordSet rs = new RecordSet(); + List> dataList = new ArrayList>(); + Map dataMap = null; + + BaseBean bb = new BaseBean(); + SimpleDateFormat sdf = new SimpleDateFormat("MM-dd" ) ; + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + + try{ + + String currentDay = sdf.format(new Date()) ; + + String currentYear = sdf2.format(new Date()) ; + bb.writeLog("currentYear:"+currentYear); + + String sql =" select h.id,h.lastname,h.sex,h.birthday,h.departmentid,h.subcompanyid1" + + " from hrmresource h " + + " where right(birthday,5) = '"+currentDay+"' " + + " and h.status in(0,1,2,3) " + + " and h.belongto is null " + + " and h.birthday is not null " + + " order by id " ; + + bb.writeLog("updateAnniversaryWishes-sql:"+sql); + + rs.executeQuery(sql); + while (rs.next()){ + String userid = Util.null2String(rs.getString("id")); + String lastname = Util.null2String(rs.getString("lastname")); + String subcompanyid1 = Util.null2String(rs.getString("subcompanyid1")); + String departmentid = Util.null2String(rs.getString("departmentid")); + String birthday = Util.null2String(rs.getString("birthday")); + + String zfy =getZfy(lastname); + + dataMap = new HashMap(); + dataMap.put("ry",userid); + dataMap.put("rymc",lastname); + dataMap.put("ryid",userid); + dataMap.put("zfy",zfy); + dataMap.put("bm",departmentid); + dataMap.put("sr",birthday); + dataMap.put("fb",subcompanyid1); + dataMap.put("nf",currentYear); + dataList.add(dataMap); + + } + + for(int i=0;i dMap = dataList.get(i); + String ry = dMap.get("ry"); + String nf = dMap.get("nf"); + String ufid = "" ; + sql = " select id from "+uftable+" where ry='"+ry+"' and nf = '"+nf+"'"; + rs.executeQuery(sql); + if(rs.next()){ + ufid = Util.null2String(rs.getString("id")); + } + if(StringUtils.isBlank(ufid)){ + updateBrithdayInfo(uftable,dMap); + }else{ + String zfy = dMap.get("zfy"); + String sr = dMap.get("sr"); + sql = " update "+uftable+" set zfy='"+zfy+"',sr='"+sr+"' where id = "+ ufid ; + boolean isTrue = rs.executeUpdate(sql); + bb.writeLog("isTrue:"+isTrue); + } + } + + }catch (Exception e){ + + } + } + + public int updateBrithdayInfo(String fromtable,Map datas){ + RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); + int count = 0; + ModeRightInfo modeRightInfo = new ModeRightInfo(); + String uuid = UUID.randomUUID().toString().replace("-",""); + 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 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); + datas.put("formmodeid", formmodeid); + datas.put("modedatacreater", modedatacreater); + datas.put("modedatacreatertype", modedatacreatertype); + datas.put("modedatacreatedate", currentdate); + datas.put("modedatacreatetime", currenttime); + datas.put("uuid", uuid); + + String tablenvalue = ""; + String tablename = ""; + for (Map.Entry 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; + } + + + public String getZfy(String lastname){ + + String zfy ="
\n" + + "

亲爱的"+lastname+"

\n" + + "

 

\n" + + "

时光是一把神奇的钥匙,让每个脚印都坚实而有力量;

\n" + + "

岁月是看不见的年轮,让每次付出都收获希望与果实;

\n" + + "

感谢您的全力奔跑,感恩您的笃定前行;

\n" + + "

今天是您的生日!

\n" + + "

在这个没有流星也可以许愿的日子里,祝您生日快乐!

\n" + + "

愿您心之所向,光芒万丈,所盼皆所成,所思终所拥!

\n" + + "

 

\n" + + "

 

\n" + + "

 MATFRON

\n" + + "
\n" ; + + return zfy; + } + + +%> + + + diff --git a/src/main/java/weaver/interfaces/mingfeng/cron/AnniversaryWishesCronJob.java b/src/main/java/weaver/interfaces/mingfeng/cron/AnniversaryWishesCronJob.java new file mode 100755 index 0000000..5723c79 --- /dev/null +++ b/src/main/java/weaver/interfaces/mingfeng/cron/AnniversaryWishesCronJob.java @@ -0,0 +1,365 @@ +package weaver.interfaces.mingfeng.cron; + +import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; +import weaver.formmode.setup.ModeRightInfo; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.interfaces.schedule.BaseCronJob; + +import java.text.SimpleDateFormat; +import java.util.*; + +public class AnniversaryWishesCronJob extends BaseCronJob +{ + /** + * + * 计划任务的入口,五任何输入参数 + */ + @Override + public void execute() + { + updateAnniversaryWishes(); + } + + public void updateAnniversaryWishes(){ + + BaseBean log = new BaseBean(); + log.writeLog("updateAnniversaryWishes! "); + + String uftable = "uf_rzznzfgly"; + RecordSet rs = new RecordSet(); + int days = 15 ; + + List> dataList = new ArrayList>(); + Map dataMap = null; + + BaseBean bb = new BaseBean(); + SimpleDateFormat sdf = new SimpleDateFormat("MM-dd" ) ; + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + + try{ + + for(int i=0;i 0 " + + " order by k.startday desc " ; + + + bb.writeLog("updateAnniversaryWishes-sql:"+sql); + + rs.executeQuery(sql); + while (rs.next()){ + String userid = Util.null2String(rs.getString("id")); + String lastname = Util.null2String(rs.getString("lastname")); + int rzzn = Util.getIntValue(Util.null2String(rs.getString("rzzn")),0); + String subcompanyid1 = Util.null2String(rs.getString("subcompanyid1")); + String departmentid = Util.null2String(rs.getString("departmentid")); + String companystartdate = Util.null2String(rs.getString("companystartdate")); + + String zfy = getZfy(lastname,rzzn); + + dataMap = new HashMap(); + dataMap.put("ry",userid); + dataMap.put("xm",lastname); + dataMap.put("zfy",zfy); + dataMap.put("bm",departmentid); + dataMap.put("rzrq",companystartdate); + dataMap.put("fb",subcompanyid1); + dataMap.put("nf",currentYear); + dataMap.put("rzzn",rzzn+""); + dataList.add(dataMap); + + +// if(rzzn > 0){ +// String rzzzdx = convert(rzzn); +// if(StringUtils.isNotBlank(rzzzdx)){ +//// String zfy ="
\n" +
+////                                    "	亲爱的"+lastname+"\n" +
+////                                    "	衷心祝贺您与"+subcompanyname+"同行"+rzzzdx+"周年快乐!同时也感谢您将自己的青春年华和工作热情奉献给了"+subcompanyname+"\n" +
+////                                    "	感谢您辛勤的付出\n" +
+////                                    "	感谢您不懈的跟随与守候!\n" +
+////                                    "	期待我们一起度过下一个周年\n" +
+////                                    "	今天的您是否在工作岗位上忙碌而忽略了这个重要的日子但公司记得您的每一分付出和努力。\n" +
+////                                    "	感谢有您, 一路相伴!\n" +
+////                                    "	未来, 我们继续同行!
" ; +// +// String zfy ="
" + +// "

亲爱的"+lastname+"

\n" + +// "

 

\n" + +// "

衷心祝贺您与铭沣同行"+rzzzdx+"周年快乐!

\n" + +// "

感谢您将自己的青春年华和工作热情奉献给了铭沣!

\n" + +// "

感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!

\n" + +// "

今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......

\n" + +// "

但公司记得您每一份付出和努力!

\n" + +// "

感谢您的一路相伴,未来我们继续同行!

\n" + +// "

 

\n" + +// "

 

\n" + +// "

 MATFRON

" + +// "
\n"; +// +// dataMap = new HashMap(); +// dataMap.put("ry",userid); +// dataMap.put("xm",lastname); +// dataMap.put("zfy",zfy); +// dataMap.put("bm",departmentid); +// dataMap.put("fb",subcompanyid1); +// dataMap.put("nf",currentYear); +// dataMap.put("rzzn",rzzn+""); +// dataList.add(dataMap); +// } +// } + } + } + + for(int i=0;i 0 " + + " order by k.startday desc " ; + + + bb.writeLog("updateAnniversaryWishes-sql:"+sql); + + rs.executeQuery(sql); + while (rs.next()){ + String userid = Util.null2String(rs.getString("id")); + String lastname = Util.null2String(rs.getString("lastname")); + int rzzn = Util.getIntValue(Util.null2String(rs.getString("rzzn")),0); + String subcompanyid1 = Util.null2String(rs.getString("subcompanyid1")); + String departmentid = Util.null2String(rs.getString("departmentid")); + String companystartdate = Util.null2String(rs.getString("companystartdate")); + + String zfy = getZfy(lastname,rzzn); + + dataMap = new HashMap(); + dataMap.put("ry",userid); + dataMap.put("xm",lastname); + dataMap.put("zfy",zfy); + dataMap.put("bm",departmentid); + dataMap.put("rzrq",companystartdate); + dataMap.put("fb",subcompanyid1); + dataMap.put("nf",currentYear); + dataMap.put("rzzn",rzzn+""); + dataList.add(dataMap); + + +// if(rzzn > 0){ +// String rzzzdx = convert(rzzn); +// if(StringUtils.isNotBlank(rzzzdx)){ +//// String zfy ="
\n" +
+////                                    "	亲爱的"+lastname+"\n" +
+////                                    "	衷心祝贺您与"+subcompanyname+"同行"+rzzzdx+"周年快乐!同时也感谢您将自己的青春年华和工作热情奉献给了"+subcompanyname+"\n" +
+////                                    "	感谢您辛勤的付出\n" +
+////                                    "	感谢您不懈的跟随与守候!\n" +
+////                                    "	期待我们一起度过下一个周年\n" +
+////                                    "	今天的您是否在工作岗位上忙碌而忽略了这个重要的日子但公司记得您的每一分付出和努力。\n" +
+////                                    "	感谢有您, 一路相伴!\n" +
+////                                    "	未来, 我们继续同行!
" ; +// +// String zfy ="
" + +// "

亲爱的"+lastname+"

\n" + +// "

 

\n" + +// "

衷心祝贺您与铭沣同行"+rzzzdx+"周年快乐!

\n" + +// "

感谢您将自己的青春年华和工作热情奉献给了铭沣!

\n" + +// "

感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!

\n" + +// "

今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......

\n" + +// "

但公司记得您每一份付出和努力!

\n" + +// "

感谢您的一路相伴,未来我们继续同行!

\n" + +// "

 

\n" + +// "

 

\n" + +// "

 MATFRON

" + +// "
\n"; +// +// dataMap = new HashMap(); +// dataMap.put("ry",userid); +// dataMap.put("xm",lastname); +// dataMap.put("zfy",zfy); +// dataMap.put("bm",departmentid); +// dataMap.put("fb",subcompanyid1); +// dataMap.put("nf",currentYear); +// dataMap.put("rzzn",rzzn+""); +// dataList.add(dataMap); +// } +// } + } + } + + for(int i=0;i dMap = dataList.get(i); + String ry = dMap.get("ry"); + String nf = dMap.get("nf"); + String ufid = "" ; + String sql = " select id from "+uftable+" where ry='"+ry+"' and nf = '"+nf+"'"; + rs.executeQuery(sql); + if(rs.next()){ + ufid = Util.null2String(rs.getString("id")); + } + if(StringUtils.isBlank(ufid)){ + updateWishesInfo(uftable,dMap); + } + } + + }catch (Exception e){ + bb.writeLog("AnniversaryWishesCronJob--updateAnniversaryWishes:e"+e); + } + } + + public int updateWishesInfo(String fromtable,Map datas){ + RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); + int count = 0; + ModeRightInfo modeRightInfo = new ModeRightInfo(); + String uuid = UUID.randomUUID().toString().replace("-",""); + 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 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); + datas.put("formmodeid", formmodeid); + datas.put("modedatacreater", modedatacreater); + datas.put("modedatacreatertype", modedatacreatertype); + datas.put("modedatacreatedate", currentdate); + datas.put("modedatacreatetime", currenttime); + datas.put("uuid", uuid); + + String tablenvalue = ""; + String tablename = ""; + for (Map.Entry 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; + } + + + + public static String convert(int number) { + if (number <= 0) { + return ""; + } + //数字对应的汉字 + String[] num = {"一", "二", "三", "四", "五", "六", "七", "八", "九"}; + //单位 + String[] unit = {"", "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千", "万亿"}; + //将输入数字转换为字符串 + String result = String.valueOf(number); + //将该字符串分割为数组存放 + char[] ch = result.toCharArray(); + //结果 字符串 + String str = ""; + int length = ch.length; + for (int i = 0; i < length; i++) { + int c = (int) ch[i] - 48; + if (c != 0) { + str += num[c - 1] + unit[length - i - 1]; + } + } + if (number < 20 && number > 9) { + str = str.substring(1); + } +// System.out.println(str); + return str ; + } + + public String getZfy(String lastname,int rzzn){ + String rzzzdx = "" ; + if(rzzn > 0){ + rzzzdx = convert(rzzn); + } + + String zfy ="
\n" + + "

亲爱的"+lastname+"

\n" + + "

 

\n" + + "

衷心祝贺您与铭沣同行"+rzzzdx+"周年快乐!

\n" + + "

感谢您将自己的青春年华和工作热情奉献给了铭沣!

\n" + + "

感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!

\n" + + "

今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......

\n" + + "

但公司记得您每一份付出和努力!

\n" + + "

感谢您的一路相伴,未来我们继续同行!

\n" + + "

 

\n" + + "

 

\n" + + "

 MATFRON

\n" + + "
"; + return zfy; + } + +} diff --git a/src/main/java/weaver/interfaces/mingfeng/cron/BirthdayWishesCronJob.java b/src/main/java/weaver/interfaces/mingfeng/cron/BirthdayWishesCronJob.java new file mode 100755 index 0000000..8f6f494 --- /dev/null +++ b/src/main/java/weaver/interfaces/mingfeng/cron/BirthdayWishesCronJob.java @@ -0,0 +1,196 @@ +package weaver.interfaces.mingfeng.cron; + +import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; +import weaver.formmode.setup.ModeRightInfo; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.interfaces.schedule.BaseCronJob; + +import java.text.SimpleDateFormat; +import java.util.*; + +public class BirthdayWishesCronJob extends BaseCronJob +{ + /** + * + * 计划任务的入口,五任何输入参数 + */ + @Override + public void execute() + { + updateBirthdayWishes(); + } + + public void updateBirthdayWishes(){ + + BaseBean log = new BaseBean(); + log.writeLog("updateAnniversaryWishes! "); + + String uftable = "uf_srzf"; + RecordSet rs = new RecordSet(); + int days = 30 ; + + List> dataList = new ArrayList>(); + Map dataMap = null; + + BaseBean bb = new BaseBean(); + SimpleDateFormat sdf = new SimpleDateFormat("MM-dd" ) ; + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + + try{ + for(int i=0;i(); + dataMap.put("ry", userid); + dataMap.put("rymc", lastname); + dataMap.put("ryid", userid); + dataMap.put("zfy", zfy); + dataMap.put("bm", departmentid); + dataMap.put("sr", birthday); + dataMap.put("fb", subcompanyid1); + dataMap.put("nf", currentYear); + dataList.add(dataMap); + + } + + for (int k = 0; k < dataList.size(); k++) { + Map dMap = dataList.get(k); + String ry = dMap.get("ry"); + String nf = dMap.get("nf"); + String ufid = ""; + sql = " select id from " + uftable + " where ry='" + ry + "' and nf = '" + nf + "'"; + rs.executeQuery(sql); + if (rs.next()) { + ufid = Util.null2String(rs.getString("id")); + } + if (StringUtils.isBlank(ufid)) { + updateBrithdayInfo(uftable, dMap); + } else { + String zfy = dMap.get("zfy"); + String sr = dMap.get("sr"); + sql = " update " + uftable + " set zfy='" + zfy + "',sr='" + sr + "' where id = " + ufid; + boolean isTrue = rs.executeUpdate(sql); + bb.writeLog("isTrue:" + isTrue); + } + } + } + }catch (Exception e){ + bb.writeLog("AnniversaryWishesCronJob--updateAnniversaryWishes:e"+e); + } + } + + public int updateBrithdayInfo(String fromtable,Map datas){ + RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); + int count = 0; + ModeRightInfo modeRightInfo = new ModeRightInfo(); + String uuid = UUID.randomUUID().toString().replace("-",""); + 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 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); + datas.put("formmodeid", formmodeid); + datas.put("modedatacreater", modedatacreater); + datas.put("modedatacreatertype", modedatacreatertype); + datas.put("modedatacreatedate", currentdate); + datas.put("modedatacreatetime", currenttime); + datas.put("uuid", uuid); + + String tablenvalue = ""; + String tablename = ""; + for (Map.Entry 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; + } + + /*** + * + * @param lastname + * @return + */ + public String getZfy(String lastname){ + + String zfy ="
\n" + + "

亲爱的"+lastname+"

\n" + + "

 

\n" + + "

时光是一把神奇的钥匙,让每个脚印都坚实而有力量;

\n" + + "

岁月是看不见的年轮,让每次付出都收获希望与果实;

\n" + + "

感谢您的全力奔跑,感恩您的笃定前行;

\n" + + "

今天是您的生日!

\n" + + "

在这个没有流星也可以许愿的日子里,祝您生日快乐!

\n" + + "

愿您心之所向,光芒万丈,所盼皆所成,所思终所拥!

\n" + + "

 

\n" + + "

 

\n" + + "

 MATFRON

\n" + + "
"; + return zfy; + } + +}