|
|
<%@ 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" %>
|
|
|
<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" %>
|
|
|
|
|
|
<%
|
|
|
|
|
|
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<String,String> dataMap = new HashMap<String,String>();
|
|
|
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<String, String>();
|
|
|
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 =" <div style=\"width: 500px;text-align: left;font-size: 14px !important;\">\n" +
|
|
|
// " <p class=\"p1\" style=\"color: #202e7f;font-size: 18px;font-weight: 600;\">亲爱的<span class=\"s1\">李旺</span>:</p>\n" +
|
|
|
// " <p class=\"p2\" > </p>\n" +
|
|
|
// " <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">衷心祝贺您与铭沣同行<span class=\"s1\">三</span>周年快乐!</p>\n" +
|
|
|
// " <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">感谢您将自己的青春年华和工作热情奉献给了铭沣!</p>\n" +
|
|
|
// " <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!</p>\n" +
|
|
|
// " <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......</p>\n" +
|
|
|
// " <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">但公司记得您每一份付出和努力!</p>\n" +
|
|
|
// " <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">感谢您的一路相伴,未来我们继续同行!</p>\n" +
|
|
|
// " <p class=\"p2\"> </p>\n" +
|
|
|
// " <p class=\"p2\"> </p>\n" +
|
|
|
// " <p class=\"p4\" style=\"float: right;color: #202e7f;font-size: 18px;font-weight: 600;\"> MATFRON</p>\n" +
|
|
|
// "</div>" ;
|
|
|
//
|
|
|
// dataMap = new HashMap<String, String>();
|
|
|
// 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<String,String> 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<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 != "") {
|
|
|
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 =" <div style=\"width: 500px;text-align: left;font-size: 14px !important;\">\n" +
|
|
|
" <p class=\"p1\" style=\"color: #202e7f;font-size: 18px;font-weight: 600;\">亲爱的<span class=\"s1\">"+lastname+"</span>:</p>\n" +
|
|
|
" <p class=\"p2\" > </p>\n" +
|
|
|
" <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">衷心祝贺您与铭沣同行<span class=\"s1\">"+rzzzdx+"</span>周年快乐!</p>\n" +
|
|
|
" <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">感谢您将自己的青春年华和工作热情奉献给了铭沣!</p>\n" +
|
|
|
" <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">感谢您辛勤的付出与不懈的跟随与守候,期待我们一起度过下一个周年!</p>\n" +
|
|
|
" <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">今天的您是否忙碌在工作岗位上而忽略了这个重要的日子......</p>\n" +
|
|
|
" <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">但公司记得您每一份付出和努力!</p>\n" +
|
|
|
" <p class=\"p3\" style=\"color: #202e7f;line-height: 30px;\">感谢您的一路相伴,未来我们继续同行!</p>\n" +
|
|
|
" <p class=\"p2\"> </p>\n" +
|
|
|
" <p class=\"p2\"> </p>\n" +
|
|
|
" <p class=\"p4\" style=\"float: right;color: #202e7f;font-size: 18px;font-weight: 600;\"> MATFRON</p>\n" +
|
|
|
" </div> ";
|
|
|
return zfy;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
%>
|
|
|
|
|
|
|
|
|
|
|
|
|