Search in sources :

Example 16 with ProductSpec

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

the class ProductSpecServiceImpl method getProductSpec.

/**
 * 获取订单list对应的规格Map
 *
 * @param billList
 * @return
 */
public Map<Long, ProductSpec> getProductSpec(List<Bill> billList) {
    Map<Long, ProductSpec> productSpecMap = new HashMap<Long, ProductSpec>();
    List<Long> productSpecIds = new ArrayList<Long>();
    for (Bill bill : billList) {
        if (null != bill.getProductSpec() && 0 != bill.getProductSpec()) {
            productSpecIds.add(bill.getProductSpec());
        }
        if (null != bill.getProductSpec1() && 0 != bill.getProductSpec1()) {
            productSpecIds.add(bill.getProductSpec1());
        }
        if (null != bill.getProductSpec2() && 0 != bill.getProductSpec2()) {
            productSpecIds.add(bill.getProductSpec2());
        }
        if (null != bill.getProductSpec3() && 0 != bill.getProductSpec3()) {
            productSpecIds.add(bill.getProductSpec3());
        }
    }
    if (productSpecIds.isEmpty())
        return productSpecMap;
    ProductSpecExample example = new ProductSpecExample();
    ProductSpecExample.Criteria criteria = example.or();
    criteria.andIdIn(productSpecIds);
    productSpecMap = sqlSession.selectMap("com.itrus.portal.db.ProductSpecMapper.selectByExample", example, "id");
    return productSpecMap;
}
Also used : ProductSpecExample(com.itrus.portal.db.ProductSpecExample) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) EditBill(com.itrus.portal.db.EditBill) Bill(com.itrus.portal.db.Bill) ProductSpec(com.itrus.portal.db.ProductSpec)

Example 17 with ProductSpec

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

the class ProductSpecServiceImpl method updateProductSpecByProduct.

/**
 * 根据产品id,将产品规格对应的优惠价格设置为null
 * @param productId
 * @throws Exception
 */
public void updateProductSpecByProduct(Long productId) throws Exception {
    List<ProductSpec> productSpecList = getProductSpecs(productId, true);
    for (ProductSpec productSpec : productSpecList) {
        productSpec.setProductField1(null);
        updateProductSpec(productSpec);
    }
}
Also used : ProductSpec(com.itrus.portal.db.ProductSpec)

Aggregations

ProductSpec (com.itrus.portal.db.ProductSpec)17 HashMap (java.util.HashMap)13 DigitalCert (com.itrus.portal.db.DigitalCert)11 Product (com.itrus.portal.db.Product)11 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11 Map (java.util.Map)10 OnPayInfo (com.itrus.portal.db.OnPayInfo)6 PayInfo (com.itrus.portal.db.PayInfo)6 UserInfo (com.itrus.portal.db.UserInfo)6 ArrayList (java.util.ArrayList)6 Bill (com.itrus.portal.db.Bill)5 Enterprise (com.itrus.portal.db.Enterprise)5 EncDecException (com.itrus.portal.exception.EncDecException)5 IOException (java.io.IOException)5 JSONArray (com.alibaba.fastjson.JSONArray)4 JSONObject (com.alibaba.fastjson.JSONObject)4 EditBill (com.itrus.portal.db.EditBill)4 OnlinePay (com.itrus.portal.db.OnlinePay)4 ReviewLog (com.itrus.portal.db.ReviewLog)4 HttpSession (javax.servlet.http.HttpSession)4