Search in sources :

Example 16 with BillExample

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

the class BillServiceImpl method getBillByBillId.

/**
 * 根据用户证书id,获取对应的解锁订单,只获取最新的一张
 * @param billId
 * @return
 */
public Bill getBillByBillId(String billId) {
    Bill bill = null;
    BillExample example = new BillExample();
    example.or().andBillIdEqualTo(billId);
    example.setLimit(1);
    example.setOrderByClause("create_time desc");
    bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByExample", example);
    return bill;
}
Also used : BillExample(com.itrus.portal.db.BillExample) Bill(com.itrus.portal.db.Bill)

Example 17 with BillExample

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

the class BillServiceImpl method getBillByOrderNumber.

/**
 * 根据申请流水号获取对面bill
 * @param orderNumber
 * @return
 */
public Bill getBillByOrderNumber(String orderNumber) {
    BillExample billExample = new BillExample();
    BillExample.Criteria criteria = billExample.or();
    criteria.andOrderNumberEqualTo(orderNumber);
    return sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByExample", billExample);
}
Also used : BillExample(com.itrus.portal.db.BillExample)

Example 18 with BillExample

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

the class BillServiceImpl method hasAuthticationLevel.

/**
 * 判断该用户,该企业,该项目,已经通过了实名认证
 * @param userInfoId
 * @param enterpriseId
 * @param projectId
 * @return
 */
public List<Bill> hasAuthticationLevel(Long userInfoId, Long enterpriseId, Long projectId) {
    boolean flag = false;
    if (null == userInfoId || null == enterpriseId || null == projectId) {
        return null;
    }
    BillExample billExample = new BillExample();
    BillExample.Criteria criteria = billExample.or();
    criteria.andUniqueIdEqualTo(userInfoId);
    criteria.andEnterpriseEqualTo(enterpriseId);
    criteria.andProjectEqualTo(projectId);
    List<Integer> billStatus = new ArrayList<>();
    billStatus.add(ComNames.BILL_STATUS_5);
    billStatus.add(ComNames.BILL_STATUS_6);
    billStatus.add(ComNames.BILL_STATUS_7);
    billStatus.add(ComNames.BILL_STATUS_8);
    billStatus.add(ComNames.BILL_STATUS_12);
    billStatus.add(ComNames.BILL_STATUS_13);
    criteria.andBillStatusIn(billStatus);
    billExample.setOrderByClause("create_time desc");
    List<Bill> bills = getBillsByExample(billExample);
    return bills;
}
Also used : BillExample(com.itrus.portal.db.BillExample) ArrayList(java.util.ArrayList) Bill(com.itrus.portal.db.Bill)

Example 19 with BillExample

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

the class SubmitReviewServiceImpl method getAuditBill.

/**
 * 根据产品list 获取需要送审的订单(状态为3已支付,待审核 的所有订单list)
 *
 * @param productList
 * @return
 */
public Map<Long, List<Bill>> getAuditBill(List<Product> productList) {
    Map<Long, List<Bill>> billListMap = new HashMap<Long, List<Bill>>();
    if (null != productList && !productList.isEmpty()) {
        for (Product product : productList) {
            BillExample example = new BillExample();
            BillExample.Criteria criteria = example.or();
            criteria.andProductEqualTo(product.getId());
            criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_3);
            // 时间逆序排列
            example.setOrderByClause("create_time asc");
            List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", example);
            if (null != billList && !billList.isEmpty()) {
                billListMap.put(product.getId(), billList);
            }
        }
    }
    return billListMap;
}
Also used : BillExample(com.itrus.portal.db.BillExample) HashMap(java.util.HashMap) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) ArrayList(java.util.ArrayList) List(java.util.List)

Example 20 with BillExample

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

the class SendReNewInfoTask method sendReNewInfo.

/**
 * 心跳更新。启动时执行一次,之后每隔24小时执行一次
 */
@Scheduled(fixedRate = 1000 * 60 * 60 * 24)
public void sendReNewInfo() {
    // 筛选出所有是待更新的,而且未发送短信的订单
    BillExample billExample = new BillExample();
    BillExample.Criteria criteria = billExample.or();
    // 订单状态是12的时候,表示是待更新的订单
    criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_12);
    // 订单的短信发送时间是Null的时候,表示未发送过通知短信
    criteria.andRenewSendTimeIsNull();
    criteria.andIsDeleteEqualTo(false);
    // billExample.setLimit(100);
    List<Bill> bills = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExample);
    if (null == bills || bills.size() < 1) {
        return;
    }
    String billSn = "";
    String mPhone = "";
    try {
        // 向每个订单发送短信通知
        for (int i = 0; i < bills.size(); i++) {
            billSn = bills.get(i).getBillId();
            UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bills.get(i).getUniqueId());
            mPhone = userInfo.getmPhone();
            UserCertExample userCertExample = new UserCertExample();
            UserCertExample.Criteria ucriteria = userCertExample.or();
            ucriteria.andIdEqualTo(bills.get(i).getOldUserCert());
            UserCert userCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByExample", userCertExample);
            Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bills.get(i).getEnterprise());
            Long projectId = bills.get(i).getProject();
            String keySn = "";
            if (null == userCert.getKeySn()) {
                keySn = "该证书未绑定key";
            } else {
                keySn = userCert.getKeySn();
            }
            String enterpriseName = enterprise.getEnterpriseName();
            Date endTime = userCert.getCertEndTime();
            // 获取订单对应的产品信息
            Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bills.get(i).getProduct());
            String productName = product.getName();
            try {
                makeCerServiceImpl.sendReNewInfo(bills.get(i), mPhone, projectId, "ZSGX", keySn, enterpriseName, endTime, productName);
            } catch (UserInfoServiceException e) {
                String type = "发送证书更新通知失败";
                String info = "用户手机号:" + mPhone + ",订单号" + bills.get(i).getBillId() + "错误信息:" + e.getMessage();
                LogUtil.syslog(sqlSession, type, info);
                log.error("ERRORLOG证书更新通知 {}", info);
                return;
            } catch (Exception e) {
                String type = "发送证书更新通知失败";
                String info = "用户手机号:" + mPhone + ",订单号" + bills.get(i).getBillId() + "错误信息:" + e.getMessage();
                LogUtil.syslog(sqlSession, type, info);
                log.error("ERRORLOG证书更新通知 {}", info);
                return;
            }
        }
    } catch (Exception e) {
        String type = "发送证书更新通知失败";
        String info = "用户手机号:" + mPhone + ",订单号" + billSn + "错误信息:" + e.getMessage();
        LogUtil.syslog(sqlSession, type, info);
        log.error("ERRORLOG证书更新通知 {}", info);
        return;
    }
}
Also used : UserCertExample(com.itrus.portal.db.UserCertExample) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) BillExample(com.itrus.portal.db.BillExample) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) UserCert(com.itrus.portal.db.UserCert) 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