Search in sources :

Example 26 with Bill

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

the class BillServiceImpl method getBillByUnlockUserCertId.

/**
 * 根据用户证书id,获取对应的解锁订单,只获取最新的一张
 * @param userCertId
 * @return
 */
public Bill getBillByUnlockUserCertId(Long userCertId) {
    Bill bill = null;
    BillExample example = new BillExample();
    example.or().andUnlockUserCertEqualTo(userCertId);
    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 27 with Bill

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

the class BillServiceImpl method getProductMapByBills.

/**
 * 根据订单list获取对应产品Map
 *
 * @param bills
 * @return
 */
public Map<Long, Product> getProductMapByBills(List<Bill> bills) {
    Map<Long, Product> productMap = new HashMap<Long, Product>();
    List<Long> productIds = new ArrayList<Long>();
    for (Bill bill : bills) {
        productIds.add(bill.getProduct());
    }
    if (!productIds.isEmpty()) {
        ProductExample example = new ProductExample();
        ProductExample.Criteria criteria = example.or();
        criteria.andIdIn(productIds);
        productMap = sqlSession.selectMap("com.itrus.portal.db.ProductMapper.selectByExample", example, "id");
    }
    return productMap;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) ProductExample(com.itrus.portal.db.ProductExample)

Example 28 with Bill

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

the class BillServiceImpl method getBillWaitingForUnlock.

/**
 * 根据用户证书id,获取对应的解锁订单,只获取最新的一张,且订单状态是提交到已解锁待开票
 * @param userCertId
 * @return
 */
public Bill getBillWaitingForUnlock(Long userCertId) {
    List<Integer> status = new ArrayList<>();
    status.add(ComNames.BILL_STATUS_1);
    status.add(ComNames.BILL_STATUS_2);
    status.add(ComNames.BILL_STATUS_11);
    status.add(ComNames.BILL_STATUS_14);
    status.add(ComNames.BILL_STATUS_15);
    status.add(ComNames.BILL_STATUS_16);
    status.add(ComNames.BILL_STATUS_17);
    Bill bill = null;
    BillExample example = new BillExample();
    example.or().andUnlockUserCertEqualTo(userCertId).andBillStatusIn(status);
    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) ArrayList(java.util.ArrayList) Bill(com.itrus.portal.db.Bill)

Example 29 with Bill

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

the class BillServiceImpl method getEnterpriseMapByBills.

/**
 * 根据订单list获取对应的企业Map
 *
 * @param bills
 * @return
 */
public Map<Long, Enterprise> getEnterpriseMapByBills(List<Bill> bills) {
    Map<Long, Enterprise> enterpriseMap = new HashMap<Long, Enterprise>();
    List<Long> enterpriseIds = new ArrayList<Long>();
    for (Bill bill : bills) {
        enterpriseIds.add(bill.getEnterprise());
    }
    if (!enterpriseIds.isEmpty()) {
        EnterpriseExample example = new EnterpriseExample();
        EnterpriseExample.Criteria criteria = example.or();
        criteria.andIdIn(enterpriseIds);
        enterpriseMap = sqlSession.selectMap("com.itrus.portal.db.EnterpriseMapper.selectByExample", example, "id");
    }
    return enterpriseMap;
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample) HashMap(java.util.HashMap) Enterprise(com.itrus.portal.db.Enterprise) ArrayList(java.util.ArrayList) Bill(com.itrus.portal.db.Bill)

Example 30 with Bill

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

the class BillServiceImpl method getProjectByBillId.

/**
 * 根据订单ID查找出对应的project
 *
 * @param billId
 * @return
 */
public Project getProjectByBillId(Long billId) {
    Bill bill = getBill(billId);
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
    return project;
}
Also used : Project(com.itrus.portal.db.Project) Bill(com.itrus.portal.db.Bill)

Aggregations

Bill (com.itrus.portal.db.Bill)74 HashMap (java.util.HashMap)45 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)42 Product (com.itrus.portal.db.Product)39 UserInfo (com.itrus.portal.db.UserInfo)32 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)27 Enterprise (com.itrus.portal.db.Enterprise)26 UserCert (com.itrus.portal.db.UserCert)22 JSONObject (com.alibaba.fastjson.JSONObject)21 Date (java.util.Date)20 ArrayList (java.util.ArrayList)19 BillExample (com.itrus.portal.db.BillExample)18 IOException (java.io.IOException)18 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)16 DigitalCert (com.itrus.portal.db.DigitalCert)15 Map (java.util.Map)12 TransactionStatus (org.springframework.transaction.TransactionStatus)10 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)10 OnPayInfo (com.itrus.portal.db.OnPayInfo)9 Proxy (com.itrus.portal.db.Proxy)9