package com.kingdee.eas.custom.facade.departmentalreporting; import java.sql.SQLException; import org.apache.log4j.Logger; import com.kingdee.bos.BOSException; import com.kingdee.bos.Context; import com.kingdee.eas.base.param.IParamControl; import com.kingdee.eas.base.param.ParamControlFactory; import com.kingdee.eas.custom.utils.SendUtils; import com.kingdee.eas.mobile.BOSMsgTypeEnum; import com.kingdee.eas.mobile.MimeTypeEnum; import com.kingdee.eas.mobile.PriorityEnum; import com.kingdee.eas.mobile.msg.util.MsgUtil; import com.kingdee.eas.util.app.DbUtil; import com.kingdee.jdbc.rowset.IRowSet; /** * 部门提报预警 * @author ISSUSER * */ public class DepartreportingFacadeControllerBean extends AbstractDepartreportingFacadeControllerBean { private static Logger logger = Logger.getLogger("com.kingdee.eas.custom.facade.departmentalreporting.DepartreportingFacadeControllerBean"); @Override public void __departReporting(Context ctx) { String sql = "select c.fid,d.fid as id, d.fname_l1 from T_WFR_WFROLE a left join T_WFR_PERSONROLE b \r\n" + "on a.fid=b.froleid left join T_PM_USER c on b.FPSERSONID = c.FPERSONID left join T_BD_Person d on d.fid=c.FPersonId where a.FNUMBER in ('22') and c.fid is not null"; logger.error("部门审批流人的SQL:" + sql); try { // 获取链接 IParamControl ipc = ParamControlFactory.getLocalInstance(ctx); String shrEnvironmentIP = ipc.getParamValue(null, "shrEnvironmentIP"); String website = shrEnvironmentIP + "/home.do"; IRowSet rowSet = DbUtil.executeQuery(ctx, sql); while (rowSet.next()) { StringBuffer strBuffer = new StringBuffer(); String title="reminder of providing data related to salary"; strBuffer.append(""); strBuffer.append("This is a kind reminder that if your department has data regarding salary needing to be paid or deducted this month, please provide it via the following link by the "+getFname(ctx)+".
"); strBuffer.append("
"); strBuffer.append(""+website+"
"); strBuffer.append("
"); strBuffer.append("Kindly note that final approver shall feedback through the same link by the same due day, otherwise the submission to HR for salary calculation will fail.
"); strBuffer.append("
"); strBuffer.append("Those who have no data to provide please disregard this reminder.
"); strBuffer.append("
"); strBuffer.append("Thanks for your cooperation.
"); strBuffer.append("
"); strBuffer.append("Best regards,
"); strBuffer.append("Human Resources Department
"); strBuffer.append(""); String content=strBuffer.toString(); System.out.println("我的html格式是"+content); // SendUtils.msgSend(ctx, title, PriorityEnum.HIGHT_VALUE, false, content,"1CV1Xix+Qua9UEeo/uZ6TIDvfe0=" , BOSMsgTypeEnum.V_TYPE_EMAIL, null, null,MimeTypeEnum.HTML); SendUtils.msgSend(ctx, title, PriorityEnum.HIGHT_VALUE, false, content,rowSet.getString("id") , BOSMsgTypeEnum.V_TYPE_EMAIL, null, null,MimeTypeEnum.HTML); System.out.println("发送成功"); } } catch (BOSException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } catch (Exception e) { logger.error("部门提报申请提醒通知失败:" + e); } } /** * 薪酬预留基础数据的名称 * @return */ public String getFname( Context ctx){ String sql="SELECT FName_l1 as fname FROM T_HR_SHRRsvItem0 where FNumber='1002'"; String fname=null; try { IRowSet rs = DbUtil.executeQuery(ctx, sql); while(rs.next()) { fname=rs.getString("fname"); } } catch (BOSException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } catch (SQLException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } return fname; } }