예제 #1
0
 private String buildEmailBody(Bill bill) {
   StringBuffer sb = new StringBuffer();
   sb.append(
       "您有一条新任务,请进入<a href=\""
           + WebConstants.URL
           + "\" target=\"_blank\">"
           + WebConstants.URL
           + "</a>来处理");
   sb.append("农场管区: ");
   sb.append(bill.getFarm() == null ? "" : bill.getFarm().getName());
   sb.append("-" + bill.getArea() == null ? "" : bill.getArea().getName());
   sb.append("\n");
   sb.append("饲料经理签名:" + (bill.getManager() == null ? "" : bill.getManager().getName()));
   sb.append("\n");
   sb.append("单据编号:" + bill.getOrderId());
   sb.append("\n");
   sb.append("管区:" + (bill.getArea() == null ? "" : bill.getArea().getName()));
   sb.append("\n");
   sb.append("单据:" + (bill.getOrderNo() == null ? "" : bill.getOrderNo()));
   sb.append("\n");
   sb.append("负责人:" + bill.getCurrUserName());
   sb.append("\n");
   sb.append("饲料规格:" + bill.getModel());
   sb.append("\n");
   sb.append("饲料型号:" + bill.getSize());
   sb.append("\n");
   sb.append("饲料吨数:" + bill.getAmount());
   sb.append("\n");
   sb.append("预计达到时间:" + Util.getDate(bill.getPlanDate()));
   sb.append("\n");
   return sb.toString();
 }
예제 #2
0
  public Bill sendBill(Bill bill) {
    Bill billInDB = this.getEntityById(Bill.class, bill.getId());
    billInDB.setPriceOnOrder(bill.getPriceOnOrder());
    billInDB.setShenheRemark(bill.getShenheRemark());
    billInDB.setShenheResult(bill.getShenheResult());
    billInDB.setTranslater(bill.getTranslater());
    billInDB.setAgentUnitPrice(bill.getAgentUnitPrice());
    billInDB.setOrderNo(bill.getOrderNo());
    billInDB.setRemark(bill.getRemark());
    if (bill.getShenheResult() == null) { // 仅仅是保存
      this.saveOrUpdateEntity(billInDB);
      // 保存日志
      BillLog log = Util.getBaseLog(BillLog.class, "已审核 -> 已审核");
      log.setBill(bill);
      log.setRemark(bill.getRemark());
      this.saveOrUpdateEntity(log);
    } else if (bill.getShenheResult()) { // 发料
      billInDB.setSendDate(new Date());
      billInDB.setStatus(WebConstants.BILL_STATUS_SENT);
      if (billInDB.getAreaAccount() != null) {
        billInDB.setCurrUserName(billInDB.getAreaAccount().getName());
      } else if (billInDB.getManager() != null) {
        billInDB.setCurrUserName(billInDB.getManager().getName());
      }
      this.saveOrUpdateEntity(billInDB);
      // 保存日志
      BillLog log = Util.getBaseLog(BillLog.class, "已审核 -> 已发料");
      log.setBill(bill);
      log.setRemark(bill.getShenheRemark());

      // 发邮件
      sendEmail(billInDB, "单据发料成功");

      baseDao.saveOrUpdate(log);
    } else { // 驳回
      billInDB.setStatus(WebConstants.BILL_STATUS_SUBMIT);
      this.saveOrUpdateEntity(billInDB);
      // 保存日志
      BillLog log = Util.getBaseLog(BillLog.class, "已审核 -> 审核中");
      log.setBill(bill);
      log.setRemark(bill.getShenheRemark());

      // 发邮件
      sendEmail(billInDB, "单据驳回");

      this.saveOrUpdateEntity(log);
    }
    return billInDB;
  }