919f7206614c8cf9391d1f5f11af2d6836d13732.svn-base 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package com.kingdee.eas.custom.facade.worktime;
  2. import org.apache.log4j.Logger;
  3. import com.kingdee.bos.BOSException;
  4. import com.kingdee.bos.Context;
  5. import com.kingdee.eas.common.EASBizException;
  6. import com.kingdee.eas.custom.utils.SendUtils;
  7. import com.kingdee.eas.mobile.BOSMsgTypeEnum;
  8. import com.kingdee.eas.mobile.MimeTypeEnum;
  9. import com.kingdee.eas.mobile.PriorityEnum;
  10. import com.kingdee.eas.mobile.msg.util.MsgUtil;
  11. import com.kingdee.eas.util.app.DbUtil;
  12. import com.kingdee.jdbc.rowset.IRowSet;
  13. //import com.kingdee.bos.metadata.entity.EntityViewInfo;
  14. //import com.kingdee.bos.dao.IObjectPK;
  15. // 加班审批预警
  16. public class WorktimeFacdeControllerBean extends AbstractWorktimeFacdeControllerBean {
  17. private static Logger logger = Logger
  18. .getLogger("com.kingdee.eas.custom.facade.worktime.WorktimeFacdeControllerBean");
  19. @Override
  20. public void __becomeWork(Context ctx) {
  21. // LocalDate today = LocalDate.now(); // 获取当前日期
  22. // 判断当前日期是几号
  23. String sql = "select s.FPERSONUSERID,p.fid,t.fname_l1 as personname,t.FApplyDate from T_BAS_AssignRead r left join T_WFR_Assign s on r.FASSIGNID = s.FASSIGNID left join T_PM_User c on c.fid=s.FPERSONUSERID left join T_BD_Person p on c.FPersonId =p.fid\r\n"
  24. + "left join (SELECT b.fid,b.fname_l1,a.FApplyDate FROM T_HR_ATS_OverTimeBill a left join T_BD_Person b on a.FProposer=b.fid)t on t.fid=p.fid\r\n"
  25. + " where r.FBOSTYPE = 'C46A580E' and s.FBIZOBJID in(select fid from T_HR_ATS_OverTimeBill FBillState where FBillState='1')";
  26. logger.error("获取加班单审批人SQL:" + sql);
  27. try {
  28. IRowSet rowSet = DbUtil.executeQuery(ctx, sql);
  29. while (rowSet.next()) {
  30. StringBuffer strBuffer = new StringBuffer();
  31. String title = "Workflow "+rowSet.getString("personname")+" Overtime Approval Form awaiting your approval";
  32. // 内容
  33. strBuffer.append("Please go to the Workspace Application to view transaction details and act on pending approval tasks");
  34. strBuffer.append("\n");
  35. strBuffer.append("\n");
  36. strBuffer.append("\n");
  37. strBuffer.append("<html><head></head><body>");
  38. strBuffer.append("<a href=\"https://gtiit.kdeascloud.com/shr\">https://gtiit.kdeascloud.com/shr</a>");
  39. strBuffer.append("</body></html>");
  40. strBuffer.append("\n");
  41. strBuffer.append("\n");
  42. strBuffer.append("\n");
  43. strBuffer.append("\r\n" +
  44. "This is an automatic workflow email. Do not reply to this mail.");
  45. String content = strBuffer.toString();
  46. // MsgUtil.msgSend(ctx, title, PriorityEnum.HIGHT_VALUE, false, content, rowSet.getString("fid"),
  47. // BOSMsgTypeEnum.V_TYPE_EMAIL, null, null, MimeTypeEnum.HTML);
  48. SendUtils.msgSend(ctx, title, PriorityEnum.HIGHT_VALUE, false, content, rowSet.getString("fid"),
  49. BOSMsgTypeEnum.V_TYPE_EMAIL, null, null, MimeTypeEnum.HTML);
  50. System.out.println("发送成功");
  51. }
  52. } catch (EASBizException e) {
  53. // TODO 自动生成的 catch 块
  54. e.printStackTrace();
  55. } catch (BOSException e) {
  56. // TODO 自动生成的 catch 块
  57. e.printStackTrace();
  58. } catch (Exception e) {
  59. logger.error("加班申请提醒通知失败:" + e.getMessage());
  60. }
  61. }
  62. }