Browse Source

复购价格库bugfix

zhijiezhao 3 years ago
parent
commit
c2d3200a68

+ 0 - 2
src/main/java/com/caimei/modules/order/service/NewShopOrderService.java

@@ -10,8 +10,6 @@ import com.caimei.modules.order.utils.ProductType;
 import com.caimei.modules.product.dao.CmPromotionDao;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.CmPromotion;
-import com.caimei.utils.MathUtil;
-import com.sun.org.apache.bcel.internal.generic.NEW;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
 import com.thinkgem.jeesite.common.utils.StringUtils;

+ 84 - 89
src/main/java/com/caimei/modules/product/service/RepeatPurchasePriceService.java

@@ -17,105 +17,100 @@ import com.caimei.modules.product.dao.RepeatPurchasePriceDao;
 
 /**
  * 再次购买Service
+ *
  * @author ye.qin
  * @version 2019-02-21
  */
 @Service
 @Transactional(readOnly = true)
 public class RepeatPurchasePriceService extends CrudService<RepeatPurchasePriceDao, RepeatPurchasePrice> {
-	@Autowired
-	private RepeatPurchasePriceDao repeatPurchasePriceDao;
+    @Autowired
+    private RepeatPurchasePriceDao repeatPurchasePriceDao;
 
-	@Autowired
-	private RepeatPurchasePriceHistoryDao repeatPurchasePriceHistoryDao;
+    @Autowired
+    private RepeatPurchasePriceHistoryDao repeatPurchasePriceHistoryDao;
 
 //	public RepeatPurchasePrice get(String id) {
 //		return super.get(id);
 //	}
-	
-	public List<RepeatPurchasePrice> findList(RepeatPurchasePrice repeatPurchasePrice) {
-		return super.findList(repeatPurchasePrice);
-	}
-	
-	public Page<RepeatPurchasePrice> findPage(Page<RepeatPurchasePrice> page, RepeatPurchasePrice repeatPurchasePrice) {
-		try{
+
+    public List<RepeatPurchasePrice> findList(RepeatPurchasePrice repeatPurchasePrice) {
+        return super.findList(repeatPurchasePrice);
+    }
+
+    public Page<RepeatPurchasePrice> findPage(Page<RepeatPurchasePrice> page, RepeatPurchasePrice repeatPurchasePrice) {
+        repeatPurchasePrice.setPage(page);
+        List<RepeatPurchasePrice> list = repeatPurchasePriceDao.findList(repeatPurchasePrice);
+        if (null != list && list.size() > 0) {
+            for (RepeatPurchasePrice bean : list) {
+                //设置用户类型
+                String type = UserType.UserType(Integer.parseInt(bean.getType()));
+                if (UserType.isClub(Integer.parseInt(bean.getType()))) {
+                    if (null != bean.getBindMobile()) bean.setMobile(bean.getBindMobile());
+                }
+                bean.setType(type);
+            }
+        }
+        page.setList(list);
+        return page;
+    }
+
+    @Transactional(readOnly = false)
+    public void save(RepeatPurchasePrice repeatPurchasePrice) {
+        super.save(repeatPurchasePrice);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(RepeatPurchasePrice repeatPurchasePrice, RepeatPurchasePriceHistory repeatPurchasePriceHistory) {
+        repeatPurchasePrice.setDelFlag("1");
+        repeatPurchasePriceDao.delete(repeatPurchasePrice);
+        List<RepeatPurchasePriceHistory> list = repeatPurchasePriceDao.findHistoryPriceList(repeatPurchasePriceHistory);
+        for (RepeatPurchasePriceHistory purchasePriceHistory : list) {
+            purchasePriceHistory.setDelFlag("1");
+            repeatPurchasePriceHistoryDao.delete(purchasePriceHistory);
+        }
+
+    }
+
+
+    public Page<RepeatPurchasePriceHistory> findHistoryPricePage(Page<RepeatPurchasePriceHistory> page, RepeatPurchasePriceHistory repeatPurchasePriceHistory) {
+        try {
             page.setOrderBy("createTime");
-			repeatPurchasePrice.setPage(page);
-			List<RepeatPurchasePrice> list = repeatPurchasePriceDao.findList(repeatPurchasePrice);
-			if(null != list && list.size() > 0){
-				for(RepeatPurchasePrice bean:list){
-					//设置用户类型
-					String type = UserType.UserType(Integer.parseInt(bean.getType()));
-
-					if(UserType.isClub(Integer.parseInt(bean.getType()))){
-					    if(null != bean.getBindMobile()) bean.setMobile(bean.getBindMobile());
-                    }
-                    bean.setType(type);
-				}
-			}
-			page.setList(list);
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-		return page;
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(RepeatPurchasePrice repeatPurchasePrice) {
-		super.save(repeatPurchasePrice);
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(RepeatPurchasePrice repeatPurchasePrice,RepeatPurchasePriceHistory repeatPurchasePriceHistory) {
-		repeatPurchasePrice.setDelFlag("1");
-		repeatPurchasePriceDao.delete(repeatPurchasePrice);
-		List<RepeatPurchasePriceHistory> list = repeatPurchasePriceDao.findHistoryPriceList(repeatPurchasePriceHistory);
-		for (RepeatPurchasePriceHistory purchasePriceHistory : list) {
-			purchasePriceHistory.setDelFlag("1");
-			repeatPurchasePriceHistoryDao.delete(purchasePriceHistory);
-		}
-
-	}
-
-
-	public Page<RepeatPurchasePriceHistory> findHistoryPricePage(Page<RepeatPurchasePriceHistory> page, RepeatPurchasePriceHistory repeatPurchasePriceHistory) {
-		try{
-			page.setOrderBy("createTime");
-			repeatPurchasePriceHistory.setPage(page);
-			List<RepeatPurchasePriceHistory> list = repeatPurchasePriceDao.findHistoryPriceList(repeatPurchasePriceHistory);
-			page.setList(list);
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-		return page;
-	}
-
-	public RepeatPurchasePrice getRepeatPurchasePrice(Integer repeatPurchasePriceId) {
-		RepeatPurchasePrice bean = new RepeatPurchasePrice();
-		try{
-			bean =  repeatPurchasePriceDao.getRepeatPurchasePrice(repeatPurchasePriceId);
-
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-		return bean;
-	}
-
-	public RepeatPurchasePrice getLastBuyPrice(Integer clubID, Integer uID, Integer productID) {
-		return repeatPurchasePriceDao.getLastBuyPrice(clubID, uID, productID);
-	}
-
-	@Transactional(readOnly = false)
-	public void insert(RepeatPurchasePrice p) {
-		repeatPurchasePriceDao.insert(p);
-	}
-
-	@Transactional(readOnly = false)
-	public void update(RepeatPurchasePrice p) {
-		repeatPurchasePriceDao.update(p);
-	}
-
-	public String findPriceProductList(Integer userId){
-		return repeatPurchasePriceDao.findPriceProductList(userId);
-	}
+            repeatPurchasePriceHistory.setPage(page);
+            List<RepeatPurchasePriceHistory> list = repeatPurchasePriceDao.findHistoryPriceList(repeatPurchasePriceHistory);
+            page.setList(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return page;
+    }
+
+    public RepeatPurchasePrice getRepeatPurchasePrice(Integer repeatPurchasePriceId) {
+        RepeatPurchasePrice bean = new RepeatPurchasePrice();
+        try {
+            bean = repeatPurchasePriceDao.getRepeatPurchasePrice(repeatPurchasePriceId);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return bean;
+    }
+
+    public RepeatPurchasePrice getLastBuyPrice(Integer clubID, Integer uID, Integer productID) {
+        return repeatPurchasePriceDao.getLastBuyPrice(clubID, uID, productID);
+    }
+
+    @Transactional(readOnly = false)
+    public void insert(RepeatPurchasePrice p) {
+        repeatPurchasePriceDao.insert(p);
+    }
+
+    @Transactional(readOnly = false)
+    public void update(RepeatPurchasePrice p) {
+        repeatPurchasePriceDao.update(p);
+    }
+
+    public String findPriceProductList(Integer userId) {
+        return repeatPurchasePriceDao.findPriceProductList(userId);
+    }
 }

+ 1 - 1
src/main/resources/mappings/modules/product/RepeatPurchasePriceMapper.xml

@@ -55,7 +55,7 @@
 			c.name AS "userName",
 			c.mobile As "mobile",
 			c.bindMobile AS "bindMobile",
-			c.registerUserTypeID As "type",
+			IFNULL(c.registerUserTypeID,3) As "type",
 			b.name AS "productName",
             CASE   b.costCheckFlag
             WHEN  1 THEN b.`costPrice`