Search in sources :

Example 21 with BillExample

use of com.itrus.portal.db.BillExample in project portal by ixinportal.

the class SendSMSSHJJTask method task.

@Scheduled(fixedRate = 1000 * 60 * 60 * 2)
public void task() {
    // start------------处理双机互斥----------
    if (null == taskFlag) {
        taskFlag = systemConfigService.isTimedTaskHost();
    }
    if (taskFlag.equals(false)) {
        return;
    }
    // end------------处理双机互斥----------
    BillExample billExample = new BillExample();
    BillExample.Criteria criteria = billExample.or();
    // 订单状态是15的时候,表示是解锁审核拒绝的订单
    criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_15);
    // 订单的短信发送时间是Null的时候,表示未发送过通知短信
    criteria.andIsDeleteEqualTo(false);
    criteria.andIsSmsEqualTo(false);
    criteria.andSendTimeIsNull();
    billExample.setLimit(20);
    List<Bill> bills = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExample);
    Integer successNumer = 0;
    for (Bill bill : bills) {
        try {
            if (reviewService.sendSmsBySHJJ(bill.getId())) {
                // 修改订单
                bill.setIsSms(true);
                bill.setSendTime(new Date());
                sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
                successNumer++;
            }
        } catch (Exception e) {
            LogUtil.syslog(sqlSession, "审核拒绝短信通知_解锁订单", "出现异常,异常信息:" + e.getMessage());
        }
    }
    LogUtil.syslog(sqlSession, "审核拒绝短信通知_解锁订单", "本次发送成功:" + successNumer + ",条, 总计:" + (null == bills ? 0 : bills.size()) + "条");
}
Also used : BillExample(com.itrus.portal.db.BillExample) Bill(com.itrus.portal.db.Bill) Date(java.util.Date) Scheduled(org.springframework.scheduling.annotation.Scheduled)

Aggregations

BillExample (com.itrus.portal.db.BillExample)21 Bill (com.itrus.portal.db.Bill)18 Product (com.itrus.portal.db.Product)10 HashMap (java.util.HashMap)8 Enterprise (com.itrus.portal.db.Enterprise)7 UserInfo (com.itrus.portal.db.UserInfo)7 ArrayList (java.util.ArrayList)7 Date (java.util.Date)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 DigitalCert (com.itrus.portal.db.DigitalCert)4 OnPayInfo (com.itrus.portal.db.OnPayInfo)4 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)4 Map (java.util.Map)4 TransactionStatus (org.springframework.transaction.TransactionStatus)4 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)4 JSONObject (com.alibaba.fastjson.JSONObject)3 Agent (com.itrus.portal.db.Agent)3 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)3 ApplicationInfoExample (com.itrus.portal.db.ApplicationInfoExample)3 BusinessLicense (com.itrus.portal.db.BusinessLicense)3