瀏覽代碼

兑换优惠券

plf 3 年之前
父節點
當前提交
0e0a3ad70e

+ 352 - 332
src/main/java/com/caimei/modules/bulkpurchase/entity/PurchaseProduct.java

@@ -2,72 +2,77 @@ package com.caimei.modules.bulkpurchase.entity;
 
 
 import com.caimei.modules.product.entity.CmPromotion;
 import com.caimei.modules.product.entity.CmPromotion;
 import com.caimei.po.ProductLadderPrice;
 import com.caimei.po.ProductLadderPrice;
-import org.hibernate.validator.constraints.Length;
-
 import com.thinkgem.jeesite.common.persistence.DataEntity;
 import com.thinkgem.jeesite.common.persistence.DataEntity;
+import org.hibernate.validator.constraints.Length;
 
 
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
  * 大宗采购商品信息Entity
  * 大宗采购商品信息Entity
+ *
  * @author jiangjunwen
  * @author jiangjunwen
  * @version 2017-03-28
  * @version 2017-03-28
  */
  */
 public class PurchaseProduct extends DataEntity<PurchaseProduct> {
 public class PurchaseProduct extends DataEntity<PurchaseProduct> {
 
 
-	private static final long serialVersionUID = 1L;
-	private String purchaseProductName;		// 商品名称
-	private String name;		// 商品名称
-	private String image;//商品图片
-	private Long contractId;		// 采购id
-	private String productNo;		// 商品编号
-	private Long productId;		// 商品ID
-	private String shopName;		// 供应商名称
-	private String price;		// 当前单价
-	private String discount;		// 折扣
-	private String discountPrice;		// 折后单价
-	private String includedTax;		//是否含税 0不含税 1含税 2未知
-	private String invoiceType;		//发票类型(基于是否含税基础) 1增值税专用发票 2增值税普通发票 3不能开票
-	private String taxRate;		// 机构税率
-	private String supplierTaxRate; // 供应商税率
-	private String addedValueTax;		// 机构税费(单)
-	private String singleShouldPayTotalTax;		// 供应商税费(单)
-	private String stipulateFlag;		// 是否是规定商品 0否 1是
-	private String shopId;
-	private String shopFee;  // 应付供应商金额
-	private String cmFee;  // 应付采美金额
-	private String otherFee;  // 应付第三方金额
-	private String shopFee1;  // 应付供应商金额(单个)
-	private String cmFee1;  // 应付采美金额(单个)
-	private String otherFee1;  // 应付第三方金额(单个)
-	private List<ProductPrivilege>  productPrivilege;
-	private String flag;//区分选择商品页面,flag=1:直接生成订单中添加商品使用,没有值表示合同中添加商品使用
-
-	private String num;//购买数量
-	private String giveNum;//手动输入赠品数
-	private String totalAddedValueTax;//总机构税费
-	private String shouldPayTotalTax;//总供应商税费
-	private String totalFee;//总费用
-	private String buyAgainFlag;//订单商品再次购买标识 0否 1是
-	private String costCheckFlag;//成本价选中标志:1固定成本 2比例成
-	private String costPrice;//成本价
-	private String costProportional;//比例成本百分比90%
-	private String priceType;  // 虚拟字段  协销帮个人用户下单的时候  priceType = normal 取普通用户价格
-	private String normalPrice; //普通用户的价格
-	private Integer userId;//用户Id
-	private String buyAgainPriceFlag;  // 商品是否使用复购价格购买标识 0否 1是
-	private String productCategory;//商品的类别:1正常商品(默认),2二手商品
-	private String secondHandType;//二手商品分类,1二手仪器,2临期产品,3其他
-	private CmPromotion cmPromotion;//参与的促销活动
-	private Integer ladderPriceFlag;        // 启用阶梯价格标识 0否 1是
+    private static final long serialVersionUID = 1L;
+    private String purchaseProductName;        // 商品名称
+    private String name;        // 商品名称
+    private String image;//商品图片
+    private Long contractId;        // 采购id
+    private String productNo;        // 商品编号
+    private Long productId;        // 商品ID
+    private String shopName;        // 供应商名称
+    private String price;        // 当前单价
+    private String discount;        // 折扣
+    private String discountPrice;        // 折后单价
+    private String includedTax;        //是否含税 0不含税 1含税 2未知
+    private String invoiceType;        //发票类型(基于是否含税基础) 1增值税专用发票 2增值税普通发票 3不能开票
+    private String taxRate;        // 机构税率
+    private String supplierTaxRate; // 供应商税率
+    private String addedValueTax;        // 机构税费(单)
+    private String singleShouldPayTotalTax;        // 供应商税费(单)
+    private String stipulateFlag;        // 是否是规定商品 0否 1是
+    private String shopId;
+    private String shopFee;  // 应付供应商金额
+    private String cmFee;  // 应付采美金额
+    private String otherFee;  // 应付第三方金额
+    private String shopFee1;  // 应付供应商金额(单个)
+    private String cmFee1;  // 应付采美金额(单个)
+    private String otherFee1;  // 应付第三方金额(单个)
+    private List<ProductPrivilege> productPrivilege;
+    private String flag;//区分选择商品页面,flag=1:直接生成订单中添加商品使用,没有值表示合同中添加商品使用
+
+    private String num;//购买数量
+    private String giveNum;//手动输入赠品数
+    private String totalAddedValueTax;//总机构税费
+    private String shouldPayTotalTax;//总供应商税费
+    private String totalFee;//总费用
+    private String buyAgainFlag;//订单商品再次购买标识 0否 1是
+    private String costCheckFlag;//成本价选中标志:1固定成本 2比例成
+    private String costPrice;//成本价
+    private String costProportional;//比例成本百分比90%
+    private String priceType;  // 虚拟字段  协销帮个人用户下单的时候  priceType = normal 取普通用户价格
+    private String normalPrice; //普通用户的价格
+    private Integer userId;//用户Id
+    private String buyAgainPriceFlag;  // 商品是否使用复购价格购买标识 0否 1是
+    private String productCategory;//商品的类别:1正常商品(默认),2二手商品
+    private String secondHandType;//二手商品分类,1二手仪器,2临期产品,3其他
+    private CmPromotion cmPromotion;//参与的促销活动
+    private Integer ladderPriceFlag;        // 启用阶梯价格标识 0否 1是
     private List<ProductLadderPrice> ladderPriceList;//阶梯价格列表
     private List<ProductLadderPrice> ladderPriceList;//阶梯价格列表
-	private String oldProductFlag;//是否是旧商品 0否 1是
-	public Integer getLadderPriceFlag() {
-		return ladderPriceFlag;
-	}
-	public void setLadderPriceFlag(Integer ladderPriceFlag) {
-		this.ladderPriceFlag = ladderPriceFlag;
-	}
+    private String oldProductFlag;//是否是旧商品 0否 1是
+    private String commodityType; //商品属性:1产品,2仪器
+    private Integer couponsLogo;    //显示优惠券查看: 1不显示 2显示
+
+    public Integer getLadderPriceFlag() {
+        return ladderPriceFlag;
+    }
+
+    public void setLadderPriceFlag(Integer ladderPriceFlag) {
+        this.ladderPriceFlag = ladderPriceFlag;
+    }
+
     public List<ProductLadderPrice> getLadderPriceList() {
     public List<ProductLadderPrice> getLadderPriceList() {
         return ladderPriceList;
         return ladderPriceList;
     }
     }
@@ -76,366 +81,381 @@ public class PurchaseProduct extends DataEntity<PurchaseProduct> {
         this.ladderPriceList = ladderPriceList;
         this.ladderPriceList = ladderPriceList;
     }
     }
 
 
-	public String getName() {
-		return name;
-	}
+    public String getName() {
+        return name;
+    }
 
 
-	public void setName(String name) {
-		this.name = name;
-	}
+    public void setName(String name) {
+        this.name = name;
+    }
 
 
-	public String getNum() {
-		return num;
-	}
+    public String getNum() {
+        return num;
+    }
 
 
-	public void setNum(String num) {
-		this.num = num;
-	}
+    public void setNum(String num) {
+        this.num = num;
+    }
 
 
-	public String getTotalFee() {
-		return totalFee;
-	}
+    public String getTotalFee() {
+        return totalFee;
+    }
 
 
-	public void setTotalFee(String totalFee) {
-		this.totalFee = totalFee;
-	}
+    public void setTotalFee(String totalFee) {
+        this.totalFee = totalFee;
+    }
 
 
-	public String getGiveNum() {
-		return giveNum;
-	}
+    public String getGiveNum() {
+        return giveNum;
+    }
 
 
-	public void setGiveNum(String giveNum) {
-		this.giveNum = giveNum;
-	}
+    public void setGiveNum(String giveNum) {
+        this.giveNum = giveNum;
+    }
 
 
-	public String getTotalAddedValueTax() {
-		return totalAddedValueTax;
-	}
+    public String getTotalAddedValueTax() {
+        return totalAddedValueTax;
+    }
 
 
-	public void setTotalAddedValueTax(String totalAddedValueTax) {
-		this.totalAddedValueTax = totalAddedValueTax;
-	}
+    public void setTotalAddedValueTax(String totalAddedValueTax) {
+        this.totalAddedValueTax = totalAddedValueTax;
+    }
 
 
-	public String getFlag() {
-		return flag;
-	}
+    public String getFlag() {
+        return flag;
+    }
 
 
-	public void setFlag(String flag) {
-		this.flag = flag;
-	}
+    public void setFlag(String flag) {
+        this.flag = flag;
+    }
 
 
-	public String getShopFee() {
-		return shopFee;
-	}
+    public String getShopFee() {
+        return shopFee;
+    }
 
 
-	public void setShopFee(String shopFee) {
-		this.shopFee = shopFee;
-	}
+    public void setShopFee(String shopFee) {
+        this.shopFee = shopFee;
+    }
 
 
-	public String getCmFee() {
-		return cmFee;
-	}
+    public String getCmFee() {
+        return cmFee;
+    }
 
 
-	public void setCmFee(String cmFee) {
-		this.cmFee = cmFee;
-	}
+    public void setCmFee(String cmFee) {
+        this.cmFee = cmFee;
+    }
 
 
-	public String getOtherFee() {
-		return otherFee;
-	}
+    public String getOtherFee() {
+        return otherFee;
+    }
 
 
-	public void setOtherFee(String otherFee) {
-		this.otherFee = otherFee;
-	}
+    public void setOtherFee(String otherFee) {
+        this.otherFee = otherFee;
+    }
 
 
 
 
-	public PurchaseProduct() {
-		super();
-	}
+    public PurchaseProduct() {
+        super();
+    }
 
 
-	public PurchaseProduct(String id){
-		super(id);
-	}
+    public PurchaseProduct(String id) {
+        super(id);
+    }
 
 
-	@Length(min=1, max=30, message="商品名称长度必须介于 1 和 30 之间")
-	public String getPurchaseProductName() {
-		return purchaseProductName;
-	}
+    @Length(min = 1, max = 30, message = "商品名称长度必须介于 1 和 30 之间")
+    public String getPurchaseProductName() {
+        return purchaseProductName;
+    }
 
 
-	public String getShopId() {
-		return shopId;
-	}
+    public String getShopId() {
+        return shopId;
+    }
 
 
-	public void setShopId(String shopId) {
-		this.shopId = shopId;
-	}
+    public void setShopId(String shopId) {
+        this.shopId = shopId;
+    }
 
 
-	public static long getSerialVersionUID() {
-		return serialVersionUID;
-	}
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
 
 
-	public List<ProductPrivilege> getProductPrivilege() {
-		return productPrivilege;
-	}
+    public List<ProductPrivilege> getProductPrivilege() {
+        return productPrivilege;
+    }
 
 
-	public void setProductPrivilege(List<ProductPrivilege> productPrivilege) {
-		this.productPrivilege = productPrivilege;
-	}
+    public void setProductPrivilege(List<ProductPrivilege> productPrivilege) {
+        this.productPrivilege = productPrivilege;
+    }
 
 
-	public void setPurchaseProductName(String purchaseProductName) {
-		this.purchaseProductName = purchaseProductName;
-	}
+    public void setPurchaseProductName(String purchaseProductName) {
+        this.purchaseProductName = purchaseProductName;
+    }
 
 
 
 
+    public Long getContractId() {
+        return contractId;
+    }
 
 
-	public Long getContractId() {
-		return contractId;
-	}
+    public void setContractId(Long contractId) {
+        this.contractId = contractId;
+    }
 
 
-	public void setContractId(Long contractId) {
-		this.contractId = contractId;
-	}
+    @Length(min = 0, max = 30, message = "商品编号长度必须介于 0 和 30 之间")
+    public String getProductNo() {
+        return productNo;
+    }
 
 
-	@Length(min=0, max=30, message="商品编号长度必须介于 0 和 30 之间")
-	public String getProductNo() {
-		return productNo;
-	}
+    public void setProductNo(String productNo) {
+        this.productNo = productNo;
+    }
 
 
-	public void setProductNo(String productNo) {
-		this.productNo = productNo;
-	}
+    public Long getProductId() {
+        return productId;
+    }
 
 
-	public Long getProductId() {
-		return productId;
-	}
+    public void setProductId(Long productId) {
+        this.productId = productId;
+    }
 
 
-	public void setProductId(Long productId) {
-		this.productId = productId;
-	}
+    @Length(min = 0, max = 20, message = "供应商名称长度必须介于 0 和 20 之间")
+    public String getShopName() {
+        return shopName;
+    }
 
 
-	@Length(min=0, max=20, message="供应商名称长度必须介于 0 和 20 之间")
-	public String getShopName() {
-		return shopName;
-	}
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
 
 
-	public void setShopName(String shopName) {
-		this.shopName = shopName;
-	}
+    public String getPrice() {
+        return price;
+    }
 
 
-	public String getPrice() {
-		return price;
-	}
+    public void setPrice(String price) {
+        this.price = price;
+    }
 
 
-	public void setPrice(String price) {
-		this.price = price;
-	}
+    public String getDiscount() {
+        return discount;
+    }
 
 
-	public String getDiscount() {
-		return discount;
-	}
+    public void setDiscount(String discount) {
+        this.discount = discount;
+    }
 
 
-	public void setDiscount(String discount) {
-		this.discount = discount;
-	}
+    public String getDiscountPrice() {
+        return discountPrice;
+    }
 
 
-	public String getDiscountPrice() {
-		return discountPrice;
-	}
+    public void setDiscountPrice(String discountPrice) {
+        this.discountPrice = discountPrice;
+    }
 
 
-	public void setDiscountPrice(String discountPrice) {
-		this.discountPrice = discountPrice;
-	}
+    public String getTaxRate() {
+        return taxRate;
+    }
 
 
-	public String getTaxRate() {
-		return taxRate;
-	}
+    public void setTaxRate(String taxRate) {
+        this.taxRate = taxRate;
+    }
 
 
-	public void setTaxRate(String taxRate) {
-		this.taxRate = taxRate;
-	}
+    public String getAddedValueTax() {
+        return addedValueTax;
+    }
 
 
-	public String getAddedValueTax() {
-		return addedValueTax;
-	}
+    public void setAddedValueTax(String addedValueTax) {
+        this.addedValueTax = addedValueTax;
+    }
 
 
-	public void setAddedValueTax(String addedValueTax) {
-		this.addedValueTax = addedValueTax;
-	}
+    @Length(min = 0, max = 1, message = "是否是规定商品 0否 1是长度必须介于 0 和 1 之间")
+    public String getStipulateFlag() {
+        return stipulateFlag;
+    }
 
 
-	@Length(min=0, max=1, message="是否是规定商品 0否 1是长度必须介于 0 和 1 之间")
-	public String getStipulateFlag() {
-		return stipulateFlag;
-	}
+    public void setStipulateFlag(String stipulateFlag) {
+        this.stipulateFlag = stipulateFlag;
+    }
 
 
-	public void setStipulateFlag(String stipulateFlag) {
-		this.stipulateFlag = stipulateFlag;
-	}
+    public String getImage() {
+        return image;
+    }
 
 
-	public String getImage() {
-		return image;
-	}
+    public void setImage(String image) {
+        this.image = image;
+    }
 
 
-	public void setImage(String image) {
-		this.image = image;
-	}
+    public String getBuyAgainFlag() {
+        return buyAgainFlag;
+    }
 
 
-	public String getBuyAgainFlag() {
-		return buyAgainFlag;
-	}
+    public void setBuyAgainFlag(String buyAgainFlag) {
+        this.buyAgainFlag = buyAgainFlag;
+    }
 
 
-	public void setBuyAgainFlag(String buyAgainFlag) {
-		this.buyAgainFlag = buyAgainFlag;
-	}
+    public String getCostCheckFlag() {
+        return costCheckFlag;
+    }
 
 
-	public String getCostCheckFlag() {
-		return costCheckFlag;
-	}
+    public void setCostCheckFlag(String costCheckFlag) {
+        this.costCheckFlag = costCheckFlag;
+    }
 
 
-	public void setCostCheckFlag(String costCheckFlag) {
-		this.costCheckFlag = costCheckFlag;
-	}
+    public String getCostPrice() {
+        return costPrice;
+    }
 
 
-	public String getCostPrice() {
-		return costPrice;
-	}
+    public void setCostPrice(String costPrice) {
+        this.costPrice = costPrice;
+    }
 
 
-	public void setCostPrice(String costPrice) {
-		this.costPrice = costPrice;
-	}
+    public String getCostProportional() {
+        return costProportional;
+    }
 
 
-	public String getCostProportional() {
-		return costProportional;
-	}
+    public void setCostProportional(String costProportional) {
+        this.costProportional = costProportional;
+    }
 
 
-	public void setCostProportional(String costProportional) {
-		this.costProportional = costProportional;
-	}
+    public String getShopFee1() {
+        return shopFee1;
+    }
 
 
-	public String getShopFee1() {
-		return shopFee1;
-	}
+    public void setShopFee1(String shopFee1) {
+        this.shopFee1 = shopFee1;
+    }
 
 
-	public void setShopFee1(String shopFee1) {
-		this.shopFee1 = shopFee1;
-	}
+    public String getCmFee1() {
+        return cmFee1;
+    }
 
 
-	public String getCmFee1() {
-		return cmFee1;
-	}
+    public void setCmFee1(String cmFee1) {
+        this.cmFee1 = cmFee1;
+    }
 
 
-	public void setCmFee1(String cmFee1) {
-		this.cmFee1 = cmFee1;
-	}
+    public String getOtherFee1() {
+        return otherFee1;
+    }
 
 
-	public String getOtherFee1() {
-		return otherFee1;
-	}
+    public void setOtherFee1(String otherFee1) {
+        this.otherFee1 = otherFee1;
+    }
 
 
-	public void setOtherFee1(String otherFee1) {
-		this.otherFee1 = otherFee1;
-	}
+    public String getPriceType() {
+        return priceType;
+    }
 
 
-	public String getPriceType() {
-		return priceType;
-	}
-
-	public void setPriceType(String priceType) {
-		this.priceType = priceType;
-	}
-
-	public String getNormalPrice() {
-		return normalPrice;
-	}
-
-	public void setNormalPrice(String normalPrice) {
-		this.normalPrice = normalPrice;
-	}
-
-	public Integer getUserId() {
-		return userId;
-	}
-
-	public void setUserId(Integer userId) {
-		this.userId = userId;
-	}
-
-	public String getBuyAgainPriceFlag() {
-		return buyAgainPriceFlag;
-	}
-
-	public void setBuyAgainPriceFlag(String buyAgainPriceFlag) {
-		this.buyAgainPriceFlag = buyAgainPriceFlag;
-	}
+    public void setPriceType(String priceType) {
+        this.priceType = priceType;
+    }
 
 
-	public String getProductCategory() {
-		return productCategory;
-	}
+    public String getNormalPrice() {
+        return normalPrice;
+    }
 
 
-	public void setProductCategory(String productCategory) {
-		this.productCategory = productCategory;
-	}
+    public void setNormalPrice(String normalPrice) {
+        this.normalPrice = normalPrice;
+    }
 
 
-	public String getSecondHandType() {
-		return secondHandType;
-	}
+    public Integer getUserId() {
+        return userId;
+    }
 
 
-	public void setSecondHandType(String secondHandType) {
-		this.secondHandType = secondHandType;
-	}
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
 
 
-	public CmPromotion getCmPromotion() {
-		return cmPromotion;
-	}
+    public String getBuyAgainPriceFlag() {
+        return buyAgainPriceFlag;
+    }
 
 
-	public void setCmPromotion(CmPromotion cmPromotion) {
-		this.cmPromotion = cmPromotion;
-	}
+    public void setBuyAgainPriceFlag(String buyAgainPriceFlag) {
+        this.buyAgainPriceFlag = buyAgainPriceFlag;
+    }
 
 
-	public String getIncludedTax() {
-		return includedTax;
-	}
+    public String getProductCategory() {
+        return productCategory;
+    }
 
 
-	public void setIncludedTax(String includedTax) {
-		this.includedTax = includedTax;
-	}
+    public void setProductCategory(String productCategory) {
+        this.productCategory = productCategory;
+    }
 
 
-	public String getInvoiceType() {
-		return invoiceType;
-	}
+    public String getSecondHandType() {
+        return secondHandType;
+    }
 
 
-	public void setInvoiceType(String invoiceType) {
-		this.invoiceType = invoiceType;
-	}
+    public void setSecondHandType(String secondHandType) {
+        this.secondHandType = secondHandType;
+    }
 
 
-	public String getSupplierTaxRate() {
-		return supplierTaxRate;
-	}
+    public CmPromotion getCmPromotion() {
+        return cmPromotion;
+    }
 
 
-	public void setSupplierTaxRate(String supplierTaxRate) {
-		this.supplierTaxRate = supplierTaxRate;
-	}
+    public void setCmPromotion(CmPromotion cmPromotion) {
+        this.cmPromotion = cmPromotion;
+    }
+
+    public String getIncludedTax() {
+        return includedTax;
+    }
+
+    public void setIncludedTax(String includedTax) {
+        this.includedTax = includedTax;
+    }
+
+    public String getInvoiceType() {
+        return invoiceType;
+    }
 
 
-	public String getShouldPayTotalTax() {
-		return shouldPayTotalTax;
-	}
+    public void setInvoiceType(String invoiceType) {
+        this.invoiceType = invoiceType;
+    }
 
 
-	public void setShouldPayTotalTax(String shouldPayTotalTax) {
-		this.shouldPayTotalTax = shouldPayTotalTax;
-	}
+    public String getSupplierTaxRate() {
+        return supplierTaxRate;
+    }
 
 
-	public String getSingleShouldPayTotalTax() {
-		return singleShouldPayTotalTax;
-	}
+    public void setSupplierTaxRate(String supplierTaxRate) {
+        this.supplierTaxRate = supplierTaxRate;
+    }
 
 
-	public void setSingleShouldPayTotalTax(String singleShouldPayTotalTax) {
-		this.singleShouldPayTotalTax = singleShouldPayTotalTax;
-	}
+    public String getShouldPayTotalTax() {
+        return shouldPayTotalTax;
+    }
 
 
-	public String getOldProductFlag() {
-		return oldProductFlag;
-	}
+    public void setShouldPayTotalTax(String shouldPayTotalTax) {
+        this.shouldPayTotalTax = shouldPayTotalTax;
+    }
+
+    public String getSingleShouldPayTotalTax() {
+        return singleShouldPayTotalTax;
+    }
 
 
-	public void setOldProductFlag(String oldProductFlag) {
-		this.oldProductFlag = oldProductFlag;
-	}
+    public void setSingleShouldPayTotalTax(String singleShouldPayTotalTax) {
+        this.singleShouldPayTotalTax = singleShouldPayTotalTax;
+    }
+
+    public String getOldProductFlag() {
+        return oldProductFlag;
+    }
+
+    public void setOldProductFlag(String oldProductFlag) {
+        this.oldProductFlag = oldProductFlag;
+    }
+
+    public String getCommodityType() {
+        return commodityType;
+    }
+
+    public void setCommodityType(String commodityType) {
+        this.commodityType = commodityType;
+    }
+
+    public Integer getCouponsLogo() {
+        return couponsLogo;
+    }
+
+    public void setCouponsLogo(Integer couponsLogo) {
+        this.couponsLogo = couponsLogo;
+    }
 }
 }

+ 20 - 11
src/main/java/com/caimei/modules/bulkpurchase/web/PurchaseProductController.java

@@ -5,10 +5,10 @@ import com.alibaba.fastjson.JSONObject;
 import com.caimei.modules.bulkpurchase.entity.OrderProduct;
 import com.caimei.modules.bulkpurchase.entity.OrderProduct;
 import com.caimei.modules.bulkpurchase.entity.ProductPrivilege;
 import com.caimei.modules.bulkpurchase.entity.ProductPrivilege;
 import com.caimei.modules.bulkpurchase.entity.PurchaseProduct;
 import com.caimei.modules.bulkpurchase.entity.PurchaseProduct;
-import com.caimei.modules.bulkpurchase.service.ContractOrderService;
 import com.caimei.modules.bulkpurchase.service.OrderProductService;
 import com.caimei.modules.bulkpurchase.service.OrderProductService;
 import com.caimei.modules.bulkpurchase.service.PurchaseProductService;
 import com.caimei.modules.bulkpurchase.service.PurchaseProductService;
 import com.caimei.modules.cibe.entity.Shop;
 import com.caimei.modules.cibe.entity.Shop;
+import com.caimei.modules.coupon.service.CmCouponService;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.product.service.BuyerProductHistoryPriceService;
 import com.caimei.modules.product.service.BuyerProductHistoryPriceService;
@@ -61,8 +61,6 @@ public class PurchaseProductController extends BaseController {
     @Autowired
     @Autowired
     private OrderProductService orderProductService;
     private OrderProductService orderProductService;
     @Autowired
     @Autowired
-    private ContractOrderService contractOrderService;
-    @Autowired
     private ClubDao clubDao;
     private ClubDao clubDao;
     @Autowired
     @Autowired
     private ProductDao productDao;
     private ProductDao productDao;
@@ -72,6 +70,8 @@ public class PurchaseProductController extends BaseController {
     private BuyerProductHistoryPriceService buyerProductHistoryPriceService;
     private BuyerProductHistoryPriceService buyerProductHistoryPriceService;
     @Autowired
     @Autowired
     private CmPromotionService cmPromotionService;
     private CmPromotionService cmPromotionService;
+    @Autowired
+    private CmCouponService cmCouponService;
 
 
     @ModelAttribute
     @ModelAttribute
     public PurchaseProduct get(@RequestParam(required = false) String id) {
     public PurchaseProduct get(@RequestParam(required = false) String id) {
@@ -118,7 +118,7 @@ public class PurchaseProductController extends BaseController {
                 //查询该商品的促销活动
                 //查询该商品的促销活动
                 CmPromotion cmPromotion = cmPromotionService.findProductPromotion(p.getShopId(), p.getProductId());
                 CmPromotion cmPromotion = cmPromotionService.findProductPromotion(p.getShopId(), p.getProductId());
                 //设置商品的税率
                 //设置商品的税率
-                if ("2".equals(p.getIncludedTax()) || StringUtils.isEmpty(p.getIncludedTax()) || ("0".equals(p.getIncludedTax()) && "3".equals(p.getInvoiceType())) ) {
+                if ("2".equals(p.getIncludedTax()) || StringUtils.isEmpty(p.getIncludedTax()) || ("0".equals(p.getIncludedTax()) && "3".equals(p.getInvoiceType()))) {
                     p.setTaxRate("0");
                     p.setTaxRate("0");
                     p.setSupplierTaxRate("0");
                     p.setSupplierTaxRate("0");
                 }
                 }
@@ -133,10 +133,10 @@ public class PurchaseProductController extends BaseController {
                     p.setCmPromotion(cmPromotion);
                     p.setCmPromotion(cmPromotion);
                     p.setLadderPriceFlag(0);
                     p.setLadderPriceFlag(0);
                 } else {
                 } else {
-                    if (p.getLadderPriceFlag().equals(1)){
+                    if (p.getLadderPriceFlag().equals(1)) {
                         // 查询阶梯价格
                         // 查询阶梯价格
                         List<ProductLadderPrice> ladderPriceList = purchaseProductService.findLadderPriceList(p.getProductId());
                         List<ProductLadderPrice> ladderPriceList = purchaseProductService.findLadderPriceList(p.getProductId());
-                        if (null != ladderPriceList && ladderPriceList.size()>0) {
+                        if (null != ladderPriceList && ladderPriceList.size() > 0) {
                             p.setPrice(ladderPriceList.get(0).getBuyPrice().toString());
                             p.setPrice(ladderPriceList.get(0).getBuyPrice().toString());
                             p.setNum(ladderPriceList.get(0).getBuyNum().toString());
                             p.setNum(ladderPriceList.get(0).getBuyNum().toString());
                             IntStream.range(0, ladderPriceList.size()).forEach(i -> {
                             IntStream.range(0, ladderPriceList.size()).forEach(i -> {
@@ -166,7 +166,7 @@ public class PurchaseProductController extends BaseController {
                                     discountPrice = lastBuyPrice.getCurrentPrice();
                                     discountPrice = lastBuyPrice.getCurrentPrice();
                                     p.setDiscountPrice(discountPrice);
                                     p.setDiscountPrice(discountPrice);
                                     // 计算折扣(折扣=折后单价/单价)[取值1-100]---四舍五入保留6位百分比小数,例如12.341234%
                                     // 计算折扣(折扣=折后单价/单价)[取值1-100]---四舍五入保留6位百分比小数,例如12.341234%
-                                    BigDecimal discount = MathUtil.round((MathUtil.mul((MathUtil.div(discountPrice, p.getPrice(),8)), 100)), 6);
+                                    BigDecimal discount = MathUtil.round((MathUtil.mul((MathUtil.div(discountPrice, p.getPrice(), 8)), 100)), 6);
                                     p.setDiscount(String.valueOf(discount));
                                     p.setDiscount(String.valueOf(discount));
                                 }
                                 }
                             }
                             }
@@ -174,6 +174,15 @@ public class PurchaseProductController extends BaseController {
                     }
                     }
                 }
                 }
             }
             }
+            if (p != null) {
+                //是否有优惠券可以查看
+                Boolean couponsLogo = cmCouponService.setCouponsLogo(userId, p.getProductId().intValue(), Integer.valueOf(p.getShopId()), p.getCommodityType());
+                if (couponsLogo) {
+                    p.setCouponsLogo(2);
+                } else {
+                    p.setCouponsLogo(1);
+                }
+            }
         }
         }
         model.addAttribute("page", page);
         model.addAttribute("page", page);
         if (StringUtils.equals(purchaseProduct.getFlag(), "1")) {
         if (StringUtils.equals(purchaseProduct.getFlag(), "1")) {
@@ -309,11 +318,11 @@ public class PurchaseProductController extends BaseController {
                 if (productPromotion != null) {
                 if (productPromotion != null) {
                     purchaseProduct.setCmPromotion(productPromotion);
                     purchaseProduct.setCmPromotion(productPromotion);
                 } else {
                 } else {
-                    if ("1".equals(product.getLadderPriceFlag())){
+                    if ("1".equals(product.getLadderPriceFlag())) {
                         purchaseProduct.setLadderPriceFlag(1);
                         purchaseProduct.setLadderPriceFlag(1);
                         // 查询阶梯价格
                         // 查询阶梯价格
                         List<ProductLadderPrice> ladderPriceList = purchaseProductService.findLadderPriceList(purchaseProduct.getProductId());
                         List<ProductLadderPrice> ladderPriceList = purchaseProductService.findLadderPriceList(purchaseProduct.getProductId());
-                        if (null != ladderPriceList && ladderPriceList.size()>0) {
+                        if (null != ladderPriceList && ladderPriceList.size() > 0) {
                             purchaseProduct.setPrice(ladderPriceList.get(0).getBuyPrice().toString());
                             purchaseProduct.setPrice(ladderPriceList.get(0).getBuyPrice().toString());
                             purchaseProduct.setNum(ladderPriceList.get(0).getBuyNum().toString());
                             purchaseProduct.setNum(ladderPriceList.get(0).getBuyNum().toString());
                             IntStream.range(0, ladderPriceList.size()).forEach(i -> {
                             IntStream.range(0, ladderPriceList.size()).forEach(i -> {
@@ -479,7 +488,7 @@ public class PurchaseProductController extends BaseController {
 
 
     @RequiresPermissions("orderproduct:orderProduct:edit")
     @RequiresPermissions("orderproduct:orderProduct:edit")
     @RequestMapping(value = "promotionDetail")
     @RequestMapping(value = "promotionDetail")
-    public String formShopFee(@RequestParam("promotionId") String promotionId,Model model) {
+    public String formShopFee(@RequestParam("promotionId") String promotionId, Model model) {
         CmPromotion cmPromotion = cmPromotionService.get(promotionId);
         CmPromotion cmPromotion = cmPromotionService.get(promotionId);
         List<Product> promotionProducts = new ArrayList<>();
         List<Product> promotionProducts = new ArrayList<>();
         List<Product> giftProducts = new ArrayList<>();
         List<Product> giftProducts = new ArrayList<>();
@@ -497,7 +506,7 @@ public class PurchaseProductController extends BaseController {
             cmPromotion.setGiftProducts(giftProducts);
             cmPromotion.setGiftProducts(giftProducts);
             cmPromotion.setPromotionShops(promotionShops);
             cmPromotion.setPromotionShops(promotionShops);
         }
         }
-        model.addAttribute("cmPromotion",cmPromotion);
+        model.addAttribute("cmPromotion", cmPromotion);
         return "modules/bulkpurchase/productPromotionDetail";
         return "modules/bulkpurchase/productPromotionDetail";
     }
     }
 }
 }

+ 34 - 1
src/main/java/com/caimei/modules/coupon/dao/CmCouponClubDao.java

@@ -1,13 +1,16 @@
 package com.caimei.modules.coupon.dao;
 package com.caimei.modules.coupon.dao;
 
 
+import com.caimei.modules.coupon.entity.CmCoupon;
+import com.caimei.modules.coupon.entity.CmCouponClub;
+import com.caimei.modules.coupon.entity.CmCouponRedemptionCode;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import com.caimei.modules.coupon.entity.CmCouponClub;
 
 
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
  * 优惠券管理DAO接口
  * 优惠券管理DAO接口
+ *
  * @author plf
  * @author plf
  * @version 2021-08-10
  * @version 2021-08-10
  */
  */
@@ -17,4 +20,34 @@ public interface CmCouponClubDao extends CrudDao<CmCouponClub> {
     List<CmCouponClub> receivingUserList(CmCouponClub cmCouponClub);
     List<CmCouponClub> receivingUserList(CmCouponClub cmCouponClub);
 
 
     List<CmCouponClub> findClubCoupon(CmCouponClub couponClub);
     List<CmCouponClub> findClubCoupon(CmCouponClub couponClub);
+
+    /**
+     * 查询兑换码是否有效
+     *
+     * @param redemptionCode 兑换码
+     * @return
+     */
+    CmCouponRedemptionCode findCouponRedemptionCode(String redemptionCode);
+
+    /**
+     * 查询优惠券信息
+     *
+     * @param couponId 优惠券id
+     * @return
+     */
+    CmCoupon getCoupons(Integer couponId);
+
+    /**
+     * 保存用户优惠券信息
+     *
+     * @param couponClub
+     */
+    void insertCouponClub(CmCouponClub couponClub);
+
+    /**
+     * 更新兑换码使用状态
+     *
+     * @param id
+     */
+    void updateRedemptionCode(String id);
 }
 }

+ 16 - 0
src/main/java/com/caimei/modules/coupon/dao/CmCouponDao.java

@@ -54,4 +54,20 @@ public interface CmCouponDao extends CrudDao<CmCoupon> {
      * @return
      * @return
      */
      */
     Integer findQuantityRedeemed(String couponId);
     Integer findQuantityRedeemed(String couponId);
+
+    /**
+     * 查询机构下所有优惠券
+     *
+     * @param userId
+     * @return
+     */
+    List<CmCoupon> findClubCouponList(Integer userId);
+
+    /**
+     * 查询活动券-指定商品
+     *
+     * @param couponId
+     * @return
+     */
+    List<Integer> findAllProductId(String couponId);
 }
 }

+ 39 - 0
src/main/java/com/caimei/modules/coupon/service/CmCouponClubService.java

@@ -1,7 +1,9 @@
 package com.caimei.modules.coupon.service;
 package com.caimei.modules.coupon.service;
 
 
 import com.caimei.modules.coupon.dao.CmCouponClubDao;
 import com.caimei.modules.coupon.dao.CmCouponClubDao;
+import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.coupon.entity.CmCouponClub;
 import com.caimei.modules.coupon.entity.CmCouponClub;
+import com.caimei.modules.coupon.entity.CmCouponRedemptionCode;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
 import com.thinkgem.jeesite.common.service.CrudService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -9,7 +11,9 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import java.util.Date;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * 优惠券管理Service
  * 优惠券管理Service
@@ -67,4 +71,39 @@ public class CmCouponClubService extends CrudService<CmCouponClubDao, CmCouponCl
         couponClubPage.setList(couponList);
         couponClubPage.setList(couponList);
         return couponClubPage;
         return couponClubPage;
     }
     }
+
+    @Transactional(readOnly = false)
+    public Map<String, Object> redeemCoupons(CmCouponRedemptionCode redemptionCode) {
+        Map<String, Object> map = new HashMap<>();
+        CmCouponRedemptionCode cmCouponRedemptionCode = cmCouponClubDao.findCouponRedemptionCode(redemptionCode.getRedemptionCode());
+        if (cmCouponRedemptionCode == null) {
+            map.put("code", -1);
+            map.put("msg", "请输入正确的兑换码");
+            return map;
+        }
+        if ("2".equals(cmCouponRedemptionCode.getStatus())) {
+            map.put("code", -1);
+            map.put("msg", "兑换码已使用,请更换兑换码进行兑换");
+            return map;
+        }
+        CmCoupon coupon = cmCouponClubDao.getCoupons(redemptionCode.getCouponId());
+        Date date = new Date();
+        if (coupon == null || date.compareTo(coupon.getStartDate()) < 0 || date.compareTo(coupon.getEndDate()) > 0) {
+            map.put("code", -1);
+            map.put("msg", "兑换的优惠券已失效");
+            return map;
+        }
+        CmCouponClub couponClub = new CmCouponClub();
+        couponClub.setCouponId(redemptionCode.getCouponId());
+        couponClub.setUserId(redemptionCode.getUserId());
+        couponClub.setSource("4");
+        couponClub.setStatus("1");
+        couponClub.setCreateDate(new Date());
+        couponClub.setDelFlag("0");
+        cmCouponClubDao.insertCouponClub(couponClub);
+        cmCouponClubDao.updateRedemptionCode(cmCouponRedemptionCode.getId());
+        map.put("code", 0);
+        map.put("msg", "优惠券兑换成功");
+        return map;
+    }
 }
 }

+ 52 - 0
src/main/java/com/caimei/modules/coupon/service/CmCouponService.java

@@ -1,6 +1,7 @@
 package com.caimei.modules.coupon.service;
 package com.caimei.modules.coupon.service;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
+import com.caimei.modules.coupon.dao.CmCouponClubDao;
 import com.caimei.modules.coupon.dao.CmCouponDao;
 import com.caimei.modules.coupon.dao.CmCouponDao;
 import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.coupon.entity.CmCouponAssociate;
 import com.caimei.modules.coupon.entity.CmCouponAssociate;
@@ -39,6 +40,8 @@ public class CmCouponService extends CrudService<CmCouponDao, CmCoupon> {
     private ProductDao productDao;
     private ProductDao productDao;
     @Autowired
     @Autowired
     private NewCmShopDao newCmShopDao;
     private NewCmShopDao newCmShopDao;
+    @Autowired
+    private CmCouponClubDao cmCouponClubDao;
 
 
     public CmCoupon get(String id) {
     public CmCoupon get(String id) {
         CmCoupon coupon = super.get(id);
         CmCoupon coupon = super.get(id);
@@ -236,4 +239,53 @@ public class CmCouponService extends CrudService<CmCouponDao, CmCoupon> {
         codePage.setList(redemptionCodeList);
         codePage.setList(redemptionCodeList);
         return codePage;
         return codePage;
     }
     }
+
+    /**
+     * 判断此商品是否有优惠
+     *
+     * @param userId        机构用户id
+     * @param productId     商品id
+     * @param shopId        供应商id
+     * @param commodityType 商品属性:1产品,2仪器
+     */
+    public Boolean setCouponsLogo(Integer userId, Integer productId, Integer shopId, String commodityType) {
+        boolean couponsLogo = false;
+        List<CmCoupon> couponList = cmCouponDao.findClubCouponList(userId);
+        if (couponList != null && couponList.size() > 0) {
+            for (CmCoupon coupon : couponList) {
+                if (coupon.getCouponType() == 4 || coupon.getCouponType() == 2) {
+                    //用户券与用户专享券
+                    couponsLogo = true;
+                    break;
+                }
+                if (coupon.getCouponType() == 0) {
+                    if ("1".equals(coupon.getProductType())) {
+                        //活动券-全商城商品
+                        couponsLogo = true;
+                        break;
+                    } else {
+                        //活动券-指定商品
+                        List<Integer> productIds = cmCouponDao.findAllProductId(coupon.getId());
+                        if (productIds.contains(productId)) {
+                            couponsLogo = true;
+                            break;
+                        }
+                    }
+                }
+                if (coupon.getCouponType() == 3 && shopId.equals(coupon.getShopId())) {
+                    //店铺券
+                    couponsLogo = true;
+                    break;
+                }
+                if (coupon.getCouponType() == 1) {
+                    //品类券
+                    if (coupon.getCategoryType().equals(commodityType)) {
+                        couponsLogo = true;
+                        break;
+                    }
+                }
+            }
+        }
+        return couponsLogo;
+    }
 }
 }

+ 24 - 0
src/main/java/com/caimei/modules/coupon/web/CmCouponClubController.java

@@ -1,6 +1,7 @@
 package com.caimei.modules.coupon.web;
 package com.caimei.modules.coupon.web;
 
 
 import com.caimei.modules.coupon.entity.CmCouponClub;
 import com.caimei.modules.coupon.entity.CmCouponClub;
+import com.caimei.modules.coupon.entity.CmCouponRedemptionCode;
 import com.caimei.modules.coupon.service.CmCouponClubService;
 import com.caimei.modules.coupon.service.CmCouponClubService;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.common.utils.StringUtils;
@@ -11,9 +12,12 @@ import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.Map;
 
 
 /**
 /**
  * 优惠券管理Controller
  * 优惠券管理Controller
@@ -69,4 +73,24 @@ public class CmCouponClubController extends BaseController {
         return "modules/coupon/clubCouponDetails";
         return "modules/coupon/clubCouponDetails";
     }
     }
 
 
+    /**
+     * 兑换优惠券
+     */
+    @ResponseBody
+    @RequestMapping("/redeem")
+    public Map<String, Object> redeemCoupons(CmCouponRedemptionCode redemptionCode) {
+        Map<String, Object> map = new HashMap<>();
+        if (redemptionCode.getUserId() == null) {
+            map.put("code", -1);
+            map.put("msg", "参数异常");
+            return map;
+        }
+        if (StringUtils.isBlank(redemptionCode.getRedemptionCode())) {
+            map.put("code", -1);
+            map.put("msg", "请输入兑换码");
+            return map;
+        }
+        return cmCouponClubService.redeemCoupons(redemptionCode);
+    }
+
 }
 }

+ 0 - 17
src/main/java/com/caimei/modules/order/dao/NewOrderDao.java

@@ -1,6 +1,5 @@
 package com.caimei.modules.order.dao;
 package com.caimei.modules.order.dao;
 
 
-import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.order.entity.CmFile;
 import com.caimei.modules.order.entity.CmFile;
 import com.caimei.modules.order.entity.NewOrder;
 import com.caimei.modules.order.entity.NewOrder;
 import com.caimei.modules.product.entity.CmPromotion;
 import com.caimei.modules.product.entity.CmPromotion;
@@ -138,20 +137,4 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
      * @param num
      * @param num
      */
      */
     void updateSendNum(@Param("markId") int markId, @Param("num") int num);
     void updateSendNum(@Param("markId") int markId, @Param("num") int num);
-
-    /**
-     * 查询机构下所有优惠券
-     *
-     * @param userId
-     * @return
-     */
-    List<CmCoupon> findClubCouponList(Integer userId);
-
-    /**
-     * 查询活动券-指定商品
-     *
-     * @param couponId
-     * @return
-     */
-    List<Integer> findAllProductId(String couponId);
 }
 }

+ 5 - 2
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -7,6 +7,7 @@ import com.caimei.exception.BusinessException;
 import com.caimei.modules.bulkpurchase.dao.OrderInvoiceDao;
 import com.caimei.modules.bulkpurchase.dao.OrderInvoiceDao;
 import com.caimei.modules.bulkpurchase.entity.OrderInvoice;
 import com.caimei.modules.bulkpurchase.entity.OrderInvoice;
 import com.caimei.modules.bulkpurchase.service.OrderInvoiceService;
 import com.caimei.modules.bulkpurchase.service.OrderInvoiceService;
+import com.caimei.modules.coupon.dao.CmCouponDao;
 import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.coupon.entity.CmCoupon;
 import com.caimei.modules.miniprogram.utils.UploadPicUtils;
 import com.caimei.modules.miniprogram.utils.UploadPicUtils;
 import com.caimei.modules.order.dao.*;
 import com.caimei.modules.order.dao.*;
@@ -106,6 +107,8 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
     private CmPromotionDao cmPromotionDao;
     private CmPromotionDao cmPromotionDao;
     @Autowired
     @Autowired
     private CmSecondHandDetailDao cmSecondHandDetailDao;
     private CmSecondHandDetailDao cmSecondHandDetailDao;
+    @Autowired
+    private CmCouponDao cmCouponDao;
 
 
     @Transactional(readOnly = false)
     @Transactional(readOnly = false)
     public void updateClauseContent(NewOrder newOrder) {
     public void updateClauseContent(NewOrder newOrder) {
@@ -2185,10 +2188,10 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
     public Map<String, Object> clubCouponList(Integer userId) {
     public Map<String, Object> clubCouponList(Integer userId) {
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         map.put("code", 0);
         map.put("code", 0);
-        List<CmCoupon> couponList = newOrderDao.findClubCouponList(userId);
+        List<CmCoupon> couponList = cmCouponDao.findClubCouponList(userId);
         couponList.forEach(coupon -> {
         couponList.forEach(coupon -> {
             if (coupon.getCouponType() == 0 && "2".equals(coupon.getProductType())) {
             if (coupon.getCouponType() == 0 && "2".equals(coupon.getProductType())) {
-                List<Integer> productIdList = newOrderDao.findAllProductId(coupon.getId());
+                List<Integer> productIdList = cmCouponDao.findAllProductId(coupon.getId());
                 coupon.setProductIdList(productIdList);
                 coupon.setProductIdList(productIdList);
             }
             }
         });
         });

+ 0 - 13
src/main/java/com/caimei/modules/order/web/NewOrderController.java

@@ -10,7 +10,6 @@ import com.caimei.modules.bulkpurchase.service.CmFinanceChargeService;
 import com.caimei.modules.bulkpurchase.service.PurchaseProductService;
 import com.caimei.modules.bulkpurchase.service.PurchaseProductService;
 import com.caimei.modules.common.utils.ExcelUtil;
 import com.caimei.modules.common.utils.ExcelUtil;
 import com.caimei.modules.common.utils.UploadUtils;
 import com.caimei.modules.common.utils.UploadUtils;
-import com.caimei.modules.coupon.entity.CmCouponRedemptionCode;
 import com.caimei.modules.order.dao.*;
 import com.caimei.modules.order.dao.*;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.order.service.*;
 import com.caimei.modules.order.service.*;
@@ -2132,16 +2131,4 @@ public class NewOrderController extends BaseController {
         }
         }
         return newOrderService.clubCouponList(userId);
         return newOrderService.clubCouponList(userId);
     }
     }
-
-
-    /*@RequestMapping("/redeem")
-    public Map<String, Object> redeemCoupons(CmCouponRedemptionCode redemptionCode) {
-        if (redeemCouponsDto.getUserId() == null || redeemCouponsDto.getSource() == null) {
-            return ResponseJson.error("参数异常", null);
-        }
-        if (org.apache.commons.lang3.StringUtils.isBlank(redeemCouponsDto.getRedemptionCode())) {
-            return ResponseJson.error("请输入兑换码", null);
-        }
-        return newOrderService.redeemCoupons(redemptionCode);
-    }*/
 }
 }

+ 1 - 29
src/main/resources/mappings/modules/bulkpurchase/PurchaseProductMapper.xml

@@ -40,42 +40,14 @@
 	<select id="findProductList" resultType="PurchaseProduct">
 	<select id="findProductList" resultType="PurchaseProduct">
 
 
 	</select>
 	</select>
-	<!--<select id="findList" resultType="PurchaseProduct">
-		SELECT
-			<include refid="purchaseProductColumns"/>
-		FROM bp_product a
-		<include refid="purchaseProductJoins"/>
-		<where>
 
 
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-					<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="productId != null and productId != ''">
-				AND a.productId = #{productId}
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND a.shopName = #{shopName}
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	-->
 	<select id="findList" resultType="PurchaseProduct" >
 	<select id="findList" resultType="PurchaseProduct" >
 		SELECT b.name shopName ,b.`shopID` shopId,a.name purchaseProductName,
 		SELECT b.name shopName ,b.`shopID` shopId,a.name purchaseProductName,
 		a.`price1` price,a.`productID` productId,a.productCode productNo,a.mainImage image
 		a.`price1` price,a.`productID` productId,a.productCode productNo,a.mainImage image
 		,a.costCheckFlag costCheckFlag,a.costPrice costPrice,a.costProportional costProportional, a.price0 AS normalPrice
 		,a.costCheckFlag costCheckFlag,a.costPrice costPrice,a.costProportional costProportional, a.price0 AS normalPrice
 		,a.ladderPriceFlag as ladderPriceFlag
 		,a.ladderPriceFlag as ladderPriceFlag
 		,a.includedTax AS includedTax, a.invoiceType AS invoiceType, a.taxPoint AS taxRate, a.supplierTaxPoint AS supplierTaxRate,
 		,a.includedTax AS includedTax, a.invoiceType AS invoiceType, a.taxPoint AS taxRate, a.supplierTaxPoint AS supplierTaxRate,
-		a.minBuyNumber AS num
+		a.minBuyNumber AS num, a.commodityType
 		FROM product a LEFT JOIN shop b ON b.shopID=a.shopID
 		FROM product a LEFT JOIN shop b ON b.shopID=a.shopID
 		<where>
 		<where>
 			<if test="purchaseProductName != null and purchaseProductName != ''">
 			<if test="purchaseProductName != null and purchaseProductName != ''">

+ 63 - 0
src/main/resources/mappings/modules/coupon/CmCouponClubMapper.xml

@@ -184,5 +184,68 @@
 		ORDER BY
 		ORDER BY
 		  a.createDate DESC
 		  a.createDate DESC
 	</select>
 	</select>
+
+	<select id="findCouponRedemptionCode" resultType="com.caimei.modules.coupon.entity.CmCouponRedemptionCode">
+        SELECT
+          `id`,
+          `couponId`,
+          `userId`,
+          `redemptionCode`,
+          `status`,
+          `redemptionTime`,
+          `addTime`
+        FROM
+          `cm_coupon_redemption_code`
+        WHERE
+          redemptionCode = #{redemptionCode}
+    </select>
+
+	<select id="getCoupons" resultType="com.caimei.modules.coupon.entity.CmCoupon">
+        SELECT
+          `id` AS "couponId",
+          `couponAmount`,
+          `touchPrice`,
+          `startDate`,
+          `endDate`,
+          `couponType`,
+          `userId`,
+          `shopId`,
+          `productType`,
+          `categoryType`
+        FROM
+          cm_coupon
+        WHERE
+          delFlag = 0
+          AND status != 2
+          AND id = #{couponId}
+    </select>
+
+	<insert id="insertCouponClub">
+        INSERT INTO `cm_coupon_club` (
+          `userId`,
+          `couponId`,
+          `orderId`,
+          `source`,
+          `status`,
+          `createDate`,
+          `useDate`,
+          `delFlag`
+        )
+        VALUES
+          (
+            #{userId},
+            #{couponId},
+            #{orderId},
+            #{source},
+            #{status},
+            #{createDate},
+            #{useDate},
+            #{delFlag}
+          )
+    </insert>
+
+	<update id="updateRedemptionCode">
+        UPDATE cm_coupon_redemption_code SET status = 2, redemptionTime = NOW() WHERE id = #{id}
+    </update>
 	
 	
 </mapper>
 </mapper>

+ 48 - 0
src/main/resources/mappings/modules/coupon/CmCouponMapper.xml

@@ -394,5 +394,53 @@
 	<select id="findQuantityRedeemed" resultType="integer">
 	<select id="findQuantityRedeemed" resultType="integer">
 		SELECT COUNT(id) FROM cm_coupon_redemption_code WHERE couponId = #{couponId} AND status = 2
 		SELECT COUNT(id) FROM cm_coupon_redemption_code WHERE couponId = #{couponId} AND status = 2
 	</select>
 	</select>
+
+	<select id="findClubCouponList" resultType="com.caimei.modules.coupon.entity.CmCoupon">
+		SELECT
+		  cc.`id`,
+		  cc.`name`,
+		  cc.`couponAmount`,
+		  cc.`touchPrice`,
+		  cc.`startDate`,
+		  cc.`endDate`,
+		  cc.`status`,
+		  cc.`couponType`,
+		  cc.`userId`,
+		  cc.`shopId`,
+		  cc.`productType`,
+		  cc.`pcBanner`,
+		  cc.`appletsBanner`,
+		  cc.`categoryType`,
+		  cc.`couponsMode`,
+		  cc.`createDate`,
+		  cc.`delFlag`,
+		  a.id AS clubCouponId
+		FROM
+		  cm_coupon_club a
+		  LEFT JOIN cm_coupon cc ON a.couponId = cc.id
+		WHERE
+		  cc.delFlag = 0
+		  AND a.delFlag = 0
+		  AND a.userId = #{userId}
+		  AND a.status = 1
+		  AND NOW() BETWEEN cc.startDate
+		  AND cc.endDate
+		  AND cc.status != 2
+		ORDER BY
+		  a.createDate DESC
+	</select>
+
+	<select id="findAllProductId" resultType="integer">
+		SELECT
+		  productId
+		FROM
+		  cm_coupon_product
+		WHERE
+		  couponId = #{couponId}
+		  AND (
+			pcStatus = 2
+			OR appletsStatus = 1
+		  )
+	</select>
 	
 	
 </mapper>
 </mapper>

+ 0 - 48
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -860,52 +860,4 @@
 	<update id="updateSendNum">
 	<update id="updateSendNum">
         UPDATE cm_sms_statistics SET sendNum = (sendNum + #{num}) WHERE markId = #{markId}
         UPDATE cm_sms_statistics SET sendNum = (sendNum + #{num}) WHERE markId = #{markId}
     </update>
     </update>
-
-	<select id="findClubCouponList" resultType="com.caimei.modules.coupon.entity.CmCoupon">
-		SELECT
-		  cc.`id`,
-		  cc.`name`,
-		  cc.`couponAmount`,
-		  cc.`touchPrice`,
-		  cc.`startDate`,
-		  cc.`endDate`,
-		  cc.`status`,
-		  cc.`couponType`,
-		  cc.`userId`,
-		  cc.`shopId`,
-		  cc.`productType`,
-		  cc.`pcBanner`,
-		  cc.`appletsBanner`,
-		  cc.`categoryType`,
-		  cc.`couponsMode`,
-		  cc.`createDate`,
-		  cc.`delFlag`,
-		  a.id AS clubCouponId
-		FROM
-		  cm_coupon_club a
-		  LEFT JOIN cm_coupon cc ON a.couponId = cc.id
-		WHERE
-		  cc.delFlag = 0
-		  AND a.delFlag = 0
-		  AND a.userId = #{userId}
-		  AND a.status = 1
-		  AND NOW() BETWEEN cc.startDate
-		  AND cc.endDate
-		  AND cc.status != 2
-		ORDER BY
-		  a.createDate DESC
-	</select>
-
-	<select id="findAllProductId" resultType="integer">
-		SELECT
-		  productId
-		FROM
-		  cm_coupon_product
-		WHERE
-		  couponId = #{couponId}
-		  AND (
-			pcStatus = 2
-			OR appletsStatus = 1
-		  )
-	</select>
 </mapper>
 </mapper>

+ 9 - 29
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductList.jsp

@@ -222,34 +222,6 @@
                 return false;
                 return false;
             }
             }
             items.push(json);
             items.push(json);
-            <%--if (null!=test&&typeof (test)!="undefined" &&test!="" ){//如果有赠送情况--%>
-            <%--$.ajax({--%>
-            <%--url: "${ctx}/bulkpurchase/purchaseProduct/returnProduct",--%>
-            <%--data: {"product": product, "test": "[" + test + "]"},--%>
-            <%--async: false,--%>
-            <%--type:"POST",--%>
-            <%--success: function (data) {--%>
-            <%--$items.each(function(){--%>
-            <%--items.push(data.purchaseProduct);--%>
-            <%--});--%>
-
-            <%--}--%>
-            <%--})--%>
-            <%--}else{--%>
-            <%--$.ajax({--%>
-            <%--url: "${ctx}/bulkpurchase/purchaseProduct/returnProduct",--%>
-            <%--data: {"product": product},--%>
-            <%--async: false,--%>
-            <%--type:"POST",--%>
-            <%--success: function (data) {--%>
-            <%--$items.each(function(){--%>
-            <%--items.push(data.purchaseProduct);--%>
-            <%--});--%>
-
-            <%--}--%>
-            <%--}--%>
-            <%--)--%>
-            <%--}--%>
             return items;
             return items;
         }
         }
         function onlynum(obj) {
         function onlynum(obj) {
@@ -305,7 +277,7 @@
             <th>总价</th>
             <th>总价</th>
             <th>能否复购</th>
             <th>能否复购</th>
             <th>促销活动</th>
             <th>促销活动</th>
-
+            <th>优惠券</th>
         </tr>
         </tr>
         </thead>
         </thead>
         <tbody>
         <tbody>
@@ -500,6 +472,14 @@
                 <td style="display: none">
                 <td style="display: none">
                     <input name="oldProductFlag"  id="oldProductFlag${state.index}" value="${purchaseProduct.oldProductFlag}" readonly  style="width: 80px">
                     <input name="oldProductFlag"  id="oldProductFlag${state.index}" value="${purchaseProduct.oldProductFlag}" readonly  style="width: 80px">
                 </td>
                 </td>
+                <td>
+                    <c:if test="${purchaseProduct.couponsLogo eq 1}">
+                        ----
+                    </c:if>
+                    <c:if test="${purchaseProduct.couponsLogo eq 2}">
+                        <a>查看</a>
+                    </c:if>
+                </td>
             </tr>
             </tr>
         </c:forEach>
         </c:forEach>
         </tbody>
         </tbody>