|
@@ -1,5 +1,8 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.entity.Goods;
|
|
|
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
+import com.ym.mec.biz.service.GoodsService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -16,6 +19,8 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
@Autowired
|
|
|
private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
|
|
|
+ @Autowired
|
|
|
+ private GoodsService goodsService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentPaymentOrderDetail> getDAO() {
|
|
@@ -26,4 +31,35 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
|
|
|
public int batchAdd(List<StudentPaymentOrderDetail> studentPaymentOrderDetailList) {
|
|
|
return studentPaymentOrderDetailDao.batchAdd(studentPaymentOrderDetailList);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<StudentPaymentOrderDetail> findApplyOrderSuccess(String musicGroupId, DealStatusEnum status) {
|
|
|
+ return studentPaymentOrderDetailDao.findApplyOrderSuccess(musicGroupId, status);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Goods> getMusicalList(String musicGroupId) {
|
|
|
+ List<StudentPaymentOrderDetail> applyOrder = findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS);
|
|
|
+ String goodsIdsStr = "";
|
|
|
+ for (StudentPaymentOrderDetail studentPaymentOrderDetail : applyOrder) {
|
|
|
+ if (studentPaymentOrderDetail.getGoodsIdList() != null && !studentPaymentOrderDetail.getGoodsIdList().isEmpty()) {
|
|
|
+ goodsIdsStr += studentPaymentOrderDetail.getGoodsIdList()+",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ goodsIdsStr = goodsIdsStr.substring(0, goodsIdsStr.length() - 1);
|
|
|
+
|
|
|
+ String[] goodSIdArr = goodsIdsStr.split(",");
|
|
|
+
|
|
|
+ List<Goods> goodies = goodsService.findGoodsByIds(goodsIdsStr);
|
|
|
+
|
|
|
+ for (Goods goods : goodies) {
|
|
|
+ goods.setSellCount(0);
|
|
|
+ for (String goodsIdStr : goodSIdArr) {
|
|
|
+ if(goods.getId().equals(Integer.parseInt(goodsIdStr))){
|
|
|
+ goods.setSellCount(goods.getSellCount()+1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return goodies;
|
|
|
+ }
|
|
|
}
|