|
@@ -23,97 +23,93 @@ import com.caimei.modules.product.dao.RepeatPurchasePriceDao;
|
|
@Service
|
|
@Service
|
|
@Transactional(readOnly = true)
|
|
@Transactional(readOnly = true)
|
|
public class RepeatPurchasePriceService extends CrudService<RepeatPurchasePriceDao, RepeatPurchasePrice> {
|
|
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) {
|
|
// public RepeatPurchasePrice get(String id) {
|
|
// return super.get(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{
|
|
|
|
- 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);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ 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");
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
}
|
|
}
|